Returns true if every element returned by iterator satisfies the given predicate. If iterator is empty, true is returned.
(Iterator<T> iterator, Predicate<? super T> predicate)
| 650 | * is returned. |
| 651 | */ |
| 652 | public static <T> boolean all(Iterator<T> iterator, Predicate<? super T> predicate) { |
| 653 | checkNotNull(predicate); |
| 654 | while (iterator.hasNext()) { |
| 655 | T element = iterator.next(); |
| 656 | if (!predicate.apply(element)) { |
| 657 | return false; |
| 658 | } |
| 659 | } |
| 660 | return true; |
| 661 | } |
| 662 | |
| 663 | /** |
| 664 | * Returns the first element in {@code iterator} that satisfies the given |
no test coverage detected