(List<T> data, Predicate<T> pred)
| 32 | } |
| 33 | |
| 34 | public static <T> List<T> filter(List<T> data, Predicate<T> pred) { |
| 35 | List<T> output = new ArrayList<>(); |
| 36 | if ( data!=null ) for (T x : data) { |
| 37 | if ( pred.test(x) ) { |
| 38 | output.add(x); |
| 39 | } |
| 40 | } |
| 41 | return output; |
| 42 | } |
| 43 | |
| 44 | public static <T> List<T> filter(Collection<T> data, Predicate<T> pred) { |
| 45 | List<T> output = new ArrayList<>(); |