Use generics for Java8 lamdas. Use @danielbodart's hack