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)
| 522 | */ |
| 523 | |
| 524 | @CanIgnoreReturnValue // TODO(kak): Consider removing this |
| 525 | public <E extends T> E min(Iterator<E> iterator) { |
| 526 | // let this throw NoSuchElementException as necessary |
| 527 | E minSoFar = iterator.next(); |
| 528 | while (iterator.hasNext()) { |
| 529 | minSoFar = min(minSoFar, iterator.next()); |
| 530 | } |
| 531 | return minSoFar; |
| 532 | } |
| 533 | |
| 534 | /** |
| 535 | * Returns the least of the specified values according to this ordering. If |