@Test public void filter() { final List<String> strings = Arrays.asList("a", "aa", "aa", "aaa", "aaa", "aaaa"); Assert.assertEquals( Arrays.asList("aaa", "aaa", "aaaa"), CollectionUtils.filter(strings, str -> str.length() > 2) ); }
public static <L> ArrayList<L> filter(List<L> list, Predicate<L> predicate) { ArrayList<L> result = new ArrayList<L>(); for (L element : list) { if (predicate.apply(element)) { result.add(element); } } return result; }
CollectionUtils { public static <L> ArrayList<L> filter(List<L> list, Predicate<L> predicate) { ArrayList<L> result = new ArrayList<L>(); for (L element : list) { if (predicate.apply(element)) { result.add(element); } } return result; } }
CollectionUtils { public static <L> ArrayList<L> filter(List<L> list, Predicate<L> predicate) { ArrayList<L> result = new ArrayList<L>(); for (L element : list) { if (predicate.apply(element)) { result.add(element); } } return result; } private  CollectionUtils(); }
CollectionUtils { public static <L> ArrayList<L> filter(List<L> list, Predicate<L> predicate) { ArrayList<L> result = new ArrayList<L>(); for (L element : list) { if (predicate.apply(element)) { result.add(element); } } return result; } private  CollectionUtils(); static ArrayList<L> filter(List<L> list, Predicate<L> predicate); static ArrayList<T> map(List<G> input, Function1<T, G> function); static Set<T> map(Set<G> input, Function1<T, G> function); static boolean isNullOrEmpty(Collection<?> input); static List<Integer> asList(int... ids); static Set<T> asSet(T... items); }
CollectionUtils { public static <L> ArrayList<L> filter(List<L> list, Predicate<L> predicate) { ArrayList<L> result = new ArrayList<L>(); for (L element : list) { if (predicate.apply(element)) { result.add(element); } } return result; } private  CollectionUtils(); static ArrayList<L> filter(List<L> list, Predicate<L> predicate); static ArrayList<T> map(List<G> input, Function1<T, G> function); static Set<T> map(Set<G> input, Function1<T, G> function); static boolean isNullOrEmpty(Collection<?> input); static List<Integer> asList(int... ids); static Set<T> asSet(T... items);  }