Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.*; import java.util.function.Predicate; import static java.util.stream.Collectors.toList; public class Main { public static <T> List<T> filter(Collection<? extends T> xs, Predicate<? super T> predicate) { return xs.stream().filter(predicate).collect(toList()); } }