Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 163 for tryFind (0.19 sec)

  1. guava-tests/test/com/google/common/collect/IterablesTest.java

        Iterable<String> list = newArrayList("cool", "pants");
        assertThat(Iterables.tryFind(list, Predicates.equalTo("cool"))).hasValue("cool");
        assertThat(Iterables.tryFind(list, Predicates.equalTo("pants"))).hasValue("pants");
        assertThat(Iterables.tryFind(list, Predicates.alwaysTrue())).hasValue("cool");
        assertThat(Iterables.tryFind(list, Predicates.alwaysFalse())).isAbsent();
        assertCanIterateAgain(list);
      }
    
    Java
    - Registered: Fri Apr 19 12:43:09 GMT 2024
    - Last Modified: Thu Mar 07 18:34:03 GMT 2024
    - 47.5K bytes
    - Viewed (0)
  2. guava-tests/test/com/google/common/collect/IteratorsTest.java

        Iterator<String> iterator = list.iterator();
        assertThat(Iterators.tryFind(iterator, Predicates.equalTo("cool"))).hasValue("cool");
      }
    
      public void testTryFind_lastElement() {
        Iterable<String> list = Lists.newArrayList("cool", "pants");
        Iterator<String> iterator = list.iterator();
        assertThat(Iterators.tryFind(iterator, Predicates.equalTo("pants"))).hasValue("pants");
      }
    
    Java
    - Registered: Fri Apr 19 12:43:09 GMT 2024
    - Last Modified: Thu Mar 07 18:34:03 GMT 2024
    - 55.7K bytes
    - Viewed (0)
  3. android/guava/src/com/google/common/collect/Iterables.java

       *
       * <p><b>{@code Stream} equivalent:</b> {@code stream.filter(predicate).findFirst()}
       *
       * @since 11.0
       */
      public static <T> Optional<T> tryFind(Iterable<T> iterable, Predicate<? super T> predicate) {
        return Iterators.tryFind(iterable.iterator(), predicate);
      }
    
      /**
       * Returns the index in {@code iterable} of the first element that satisfies the provided {@code
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Wed Apr 24 19:38:27 GMT 2024
    - 42.8K bytes
    - Viewed (0)
  4. android/guava-tests/test/com/google/common/collect/IteratorsTest.java

        Iterator<String> iterator = list.iterator();
        assertThat(Iterators.tryFind(iterator, Predicates.equalTo("cool"))).hasValue("cool");
      }
    
      public void testTryFind_lastElement() {
        Iterable<String> list = Lists.newArrayList("cool", "pants");
        Iterator<String> iterator = list.iterator();
        assertThat(Iterators.tryFind(iterator, Predicates.equalTo("pants"))).hasValue("pants");
      }
    
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Thu Mar 07 18:34:03 GMT 2024
    - 55.7K bytes
    - Viewed (0)
  5. android/guava-tests/test/com/google/common/collect/IterablesTest.java

        Iterable<String> list = newArrayList("cool", "pants");
        assertThat(Iterables.tryFind(list, Predicates.equalTo("cool"))).hasValue("cool");
        assertThat(Iterables.tryFind(list, Predicates.equalTo("pants"))).hasValue("pants");
        assertThat(Iterables.tryFind(list, Predicates.alwaysTrue())).hasValue("cool");
        assertThat(Iterables.tryFind(list, Predicates.alwaysFalse())).isAbsent();
        assertCanIterateAgain(list);
      }
    
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Thu Mar 07 18:34:03 GMT 2024
    - 46K bytes
    - Viewed (0)
  6. guava/src/com/google/common/collect/Iterables.java

       *
       * <p><b>{@code Stream} equivalent:</b> {@code stream.filter(predicate).findFirst()}
       *
       * @since 11.0
       */
      public static <T> Optional<T> tryFind(Iterable<T> iterable, Predicate<? super T> predicate) {
        return Iterators.tryFind(iterable.iterator(), predicate);
      }
    
      /**
       * Returns the index in {@code iterable} of the first element that satisfies the provided {@code
    Java
    - Registered: Fri Apr 05 12:43:09 GMT 2024
    - Last Modified: Thu Feb 15 16:12:13 GMT 2024
    - 42.5K bytes
    - Viewed (0)
  7. android/guava/src/com/google/common/collect/Iterators.java

       * will be left exhausted: its {@code hasNext()} method will return {@code false}. If it is
       * possible that <i>no</i> element will match, use {@link #tryFind} or {@link #find(Iterator,
       * Predicate, Object)} instead.
       *
       * @throws NoSuchElementException if no element in {@code iterator} matches the given predicate
       */
      @ParametricNullness
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Sat Apr 20 03:33:06 GMT 2024
    - 50.6K bytes
    - Viewed (0)
  8. guava/src/com/google/common/collect/Iterators.java

       * will be left exhausted: its {@code hasNext()} method will return {@code false}. If it is
       * possible that <i>no</i> element will match, use {@link #tryFind} or {@link #find(Iterator,
       * Predicate, Object)} instead.
       *
       * @throws NoSuchElementException if no element in {@code iterator} matches the given predicate
       */
      @ParametricNullness
    Java
    - Registered: Fri Apr 05 12:43:09 GMT 2024
    - Last Modified: Tue Jan 30 00:14:39 GMT 2024
    - 50.5K bytes
    - Viewed (0)
  9. android/guava/src/com/google/common/collect/FluentIterable.java

       */
      @SuppressWarnings("nullness") // Unsafe, but we can't do much about it now.
      public final Optional<@NonNull E> firstMatch(Predicate<? super E> predicate) {
        return Iterables.<E>tryFind((Iterable<@NonNull E>) getDelegate(), predicate);
      }
    
      /**
       * Returns a fluent iterable that applies {@code function} to each element of this fluent
       * iterable.
       *
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Tue Jan 30 00:14:39 GMT 2024
    - 35.7K bytes
    - Viewed (0)
  10. guava/src/com/google/common/collect/FluentIterable.java

       */
      @SuppressWarnings("nullness") // Unsafe, but we can't do much about it now.
      public final Optional<@NonNull E> firstMatch(Predicate<? super E> predicate) {
        return Iterables.<E>tryFind((Iterable<@NonNull E>) getDelegate(), predicate);
      }
    
      /**
       * Returns a fluent iterable that applies {@code function} to each element of this fluent
       * iterable.
       *
    Java
    - Registered: Fri Apr 05 12:43:09 GMT 2024
    - Last Modified: Tue Jan 30 00:14:39 GMT 2024
    - 35.3K bytes
    - Viewed (0)
Back to top