Method
findFirst
(List<T> data, Predicate<T> pred)
Source from the content-addressed store, hash-verified
| 23 | |
| 24 | // Generic filtering, mapping, joining that should be in the standard library but aren't |
| 25 | public static <T> T findFirst(List<T> data, Predicate<T> pred) { |
| 26 | if ( data!=null ) for (T x : data) { |
| 27 | if ( pred.test(x) ) { |
| 28 | return x; |
| 29 | } |
| 30 | } |
| 31 | return null; |
| 32 | } |
| 33 | |
| 34 | public static <T> List<T> filter(List<T> data, Predicate<T> pred) { |
| 35 | List<T> output = new ArrayList<>(); |
Callers
nothing calls this directly
Tested by
no test coverage detected