Skip to content

Instantly share code, notes, and snippets.

@Adebski
Adebski / gist:10026423
Last active August 29, 2015 13:58
Example of improved method context type inference
class MyList<E> {
private E head = null;
private MyList<E> tail = null;
public static <Z> MyList<Z> nil() {
return new MyList<Z>();
};
public static <Z> MyList<Z> cons(Z head, MyList<Z> tail) {
MyList<Z> result = new MyList<>();
@Adebski
Adebski / gist:10026024
Last active August 29, 2015 13:58
Lambda/functional interface example in one file
@FunctionalInterface
interface ConstructorFuncInterface{
public Employee createEmployee(int a, String b);
}
@FunctionalInterface
interface MethodFuncInterface{
public int getInt();
}