Returns whether there is an element in list for which predicate is true.
(
List<? extends E> list, Predicate1<E> predicate)
| 1921 | * {@code predicate} is true. |
| 1922 | */ |
| 1923 | public static <E> boolean exists( |
| 1924 | List<? extends E> list, Predicate1<E> predicate) { |
| 1925 | for (E e : list) { |
| 1926 | if (predicate.apply(e)) { |
| 1927 | return true; |
| 1928 | } |
| 1929 | } |
| 1930 | return false; |
| 1931 | } |
| 1932 | |
| 1933 | /** |
| 1934 | * Returns whether {@code predicate} is true for all elements of |