/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
    interface Func<A> {
      double apply(Optional<A> a);
    }

    public static double compute(Func<? super Double> f) {
        // Sometimes amend the function to do something slightly different
        Func<? super Double> g = f;
        if (System.currentTimeMillis() > 0)
            g = oa -> Math.max(0, f.apply(oa.map(a -> a)));

        return g.apply(Optional.of(3.14)) + g.apply(Optional.empty());
    }

	public static void main (String[] args) throws java.lang.Exception
	{
		Func<Double> f = oa -> 0;
		compute(f);
				
		Func<Object> g = oa -> 0;
		compute(g);
	}
}