(final Iterable<T> source, final Function<T, Integer> valueAccessor)
| 15 | |
| 16 | // Returns the value matching predicate conditions with the maximum value of whatever valueAccessor returns. |
| 17 | public static final <T> Integer max(final Iterable<T> source, final Function<T, Integer> valueAccessor) { |
| 18 | if (source == null) { return null; } |
| 19 | int max = Integer.MIN_VALUE; |
| 20 | for (final T c : source) { |
| 21 | int value = valueAccessor.apply(c); |
| 22 | if (value > max) { |
| 23 | max = value; |
| 24 | } |
| 25 | } |
| 26 | return max; |
| 27 | } |
| 28 | |
| 29 | public static Integer max(final Iterable<Integer> source) { |
| 30 | if (source == null) return null; |
no test coverage detected