// Funktionen public static List map(UnaryOp obj,List l) { // Determine the dynamic type of the list Class c = l.getClass(); try { // Create a result list of the same List type List result = c.newInstance(); //type.cast(type.newInstance()); // Copy elements satifying p for ( T1 x : l ) result.add(obj.op(x)); return result; } catch (Exception e) { return null; } } public interface UnaryOp { U op(T x); } public class Sign implements UnaryOp { public Integer op(Integer x) { return x.compareTo(0); } }