Returns the least of the specified values according to this ordering. If there are multiple least values, the first of those is returned. The iterator will be left exhausted: its hasNext() method will return false. @param iterator the iterator whose minimum element is to be determin
(Iterator<E> iterator)
| 507 | * @since 11.0 |
| 508 | */ |
| 509 | @CanIgnoreReturnValue // TODO(kak): Consider removing this |
| 510 | public <E extends T> E min(Iterator<E> iterator) { |
| 511 | // let this throw NoSuchElementException as necessary |
| 512 | E minSoFar = iterator.next(); |
| 513 | |
| 514 | while (iterator.hasNext()) { |
| 515 | minSoFar = min(minSoFar, iterator.next()); |
| 516 | } |
| 517 | |
| 518 | return minSoFar; |
| 519 | } |
| 520 | |
| 521 | /** |
| 522 | * Returns the least of the specified values according to this ordering. If |
no test coverage detected