import java.util.Collection; import java.util.function.Predicate; import java.util.stream.Collectors; public class Strain { public static Collection keep(Collection coll, Predicate func) { return coll.stream().filter(func).collect(Collectors.toList()); } public static Collection discard(Collection coll, Predicate func) { return coll.stream().filter(func.negate()).collect(Collectors.toList()); } }