// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.util.Arrays;
import java.util.List;

public class GenFun {
    public static interface Toy<E> {
        public List<E> get();
    }
    public static <E> void checkToy(Toy<E> toy) {
        for(E o : toy.get()) {
            System.out.println(o);
        }
    }
    public static void main(String[] args) {
        checkToy(new Toy<Integer>() {
            @Override
            public List<Integer> get() {
                List<Integer> ret = Arrays.asList(10);
                return ret;
            }
        });
        checkToy(() -> { return Arrays.<Integer>asList(10); });
    }
}
