(Iterable<T> a, Comparator<T> c)
| 94 | } |
| 95 | |
| 96 | static public <T> T min(Iterable<T> a, Comparator<T> c) { |
| 97 | boolean first = true; |
| 98 | T minIs = null; |
| 99 | |
| 100 | for (T t : a) { |
| 101 | if (first) { |
| 102 | minIs = t; |
| 103 | first = false; |
| 104 | } else { |
| 105 | if (c.compare(minIs, t) > 0) { |
| 106 | minIs = t; |
| 107 | } |
| 108 | } |
| 109 | } |
| 110 | return minIs; |
| 111 | } |
| 112 | |
| 113 | /** |
| 114 | * An autoclosable that doesn't throw an exception |
no test coverage detected