Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 30 for getOnlyElement (0.08 sec)

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

        Iterator<String> iterator = singletonList("foo").iterator();
        assertEquals("foo", getOnlyElement(iterator));
      }
    
      public void testGetOnlyElement_noDefault_empty() {
        Iterator<String> iterator = emptyIterator();
        assertThrows(NoSuchElementException.class, () -> getOnlyElement(iterator));
      }
    
      public void testGetOnlyElement_noDefault_moreThanOneLessThanFiveElements() {
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Wed Oct 30 16:15:19 UTC 2024
    - 54.1K bytes
    - Viewed (0)
  2. guava-tests/test/com/google/common/collect/IteratorsTest.java

        Iterator<String> iterator = singletonList("foo").iterator();
        assertEquals("foo", getOnlyElement(iterator));
      }
    
      public void testGetOnlyElement_noDefault_empty() {
        Iterator<String> iterator = emptyIterator();
        assertThrows(NoSuchElementException.class, () -> getOnlyElement(iterator));
      }
    
      public void testGetOnlyElement_noDefault_moreThanOneLessThanFiveElements() {
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Wed Oct 30 16:15:19 UTC 2024
    - 54.1K bytes
    - Viewed (0)
  3. android/guava-tests/test/com/google/common/util/concurrent/ForwardingObjectTester.java

        @SuppressWarnings("unchecked") // super interface type of T
        Class<? super T> interfaceType =
            (Class<? super T>) Iterables.getOnlyElement(Arrays.asList(forwarderClass.getInterfaces()));
        new ForwardingWrapperTester()
            .testForwarding(
                interfaceType,
                new Function<Object, T>() {
                  @Override
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Thu Jan 05 19:41:03 UTC 2023
    - 2.5K bytes
    - Viewed (0)
  4. android/guava-tests/test/com/google/common/collect/IterablesTest.java

      }
    
      public void testGetOnlyElement_withDefault_singleton() {
        Iterable<String> iterable = singletonList("foo");
        assertEquals("foo", getOnlyElement(iterable, "bar"));
      }
    
      public void testGetOnlyElement_withDefault_empty() {
        Iterable<String> iterable = emptyList();
        assertEquals("bar", getOnlyElement(iterable, "bar"));
      }
    
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Wed Oct 30 19:12:33 UTC 2024
    - 45K bytes
    - Viewed (0)
  5. android/guava/src/com/google/common/collect/Iterables.java

       * @throws IllegalArgumentException if the iterable contains multiple elements
       */
      @ParametricNullness
      public static <T extends @Nullable Object> T getOnlyElement(Iterable<T> iterable) {
        return Iterators.getOnlyElement(iterable.iterator());
      }
    
      /**
       * Returns the single element contained in {@code iterable}, or {@code defaultValue} if the
       * iterable is empty.
       *
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Wed Apr 24 19:38:27 UTC 2024
    - 42.8K bytes
    - Viewed (0)
  6. guava-tests/test/com/google/common/util/concurrent/MoreExecutorsTest.java

        List<Future<String>> results;
    
        results = service.invokeAll(callables);
        assertThat(getOnlyElement(results)).isInstanceOf(TrustedListenableFutureTask.class);
    
        results = service.invokeAll(callables, 1, SECONDS);
        assertThat(getOnlyElement(results)).isInstanceOf(TrustedListenableFutureTask.class);
    
        /*
         * TODO(cpovirk): move ForwardingTestCase somewhere common, and use it to
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Fri Oct 18 22:10:29 UTC 2024
    - 28.1K bytes
    - Viewed (0)
  7. android/guava-tests/test/com/google/common/util/concurrent/MoreExecutorsTest.java

        List<Future<String>> results;
    
        results = service.invokeAll(callables);
        assertThat(getOnlyElement(results)).isInstanceOf(TrustedListenableFutureTask.class);
    
        results = service.invokeAll(callables, 1, SECONDS);
        assertThat(getOnlyElement(results)).isInstanceOf(TrustedListenableFutureTask.class);
    
        /*
         * TODO(cpovirk): move ForwardingTestCase somewhere common, and use it to
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Fri Oct 18 22:10:29 UTC 2024
    - 28.1K bytes
    - Viewed (0)
  8. android/guava/src/com/google/common/collect/ImmutableTable.java

     * limitations under the License.
     */
    
    package com.google.common.collect;
    
    import static com.google.common.base.Preconditions.checkNotNull;
    import static com.google.common.collect.Iterables.getOnlyElement;
    import static com.google.common.collect.Tables.immutableCell;
    
    import com.google.common.annotations.GwtCompatible;
    import com.google.common.annotations.GwtIncompatible;
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Wed Oct 30 16:15:19 UTC 2024
    - 17.5K bytes
    - Viewed (0)
  9. guava/src/com/google/common/collect/ImmutableRangeSet.java

    import static com.google.common.base.Preconditions.checkElementIndex;
    import static com.google.common.base.Preconditions.checkNotNull;
    import static com.google.common.collect.Iterables.getOnlyElement;
    import static com.google.common.collect.Iterators.emptyIterator;
    import static com.google.common.collect.SortedLists.KeyAbsentBehavior.NEXT_HIGHER;
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Wed Oct 30 16:15:19 UTC 2024
    - 27K bytes
    - Viewed (0)
  10. android/guava-tests/test/com/google/common/base/ThrowablesTest.java

        IllegalStateException ex = new IllegalStateException(re);
    
        assertThat(getCausalChain(ex)).containsExactly(ex, re, iae, sue).inOrder();
        assertSame(sue, Iterables.getOnlyElement(getCausalChain(sue)));
    
        List<Throwable> causes = getCausalChain(ex);
        assertThrows(UnsupportedOperationException.class, () -> causes.add(new RuntimeException()));
      }
    
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Tue Sep 17 18:14:12 UTC 2024
    - 14.6K bytes
    - Viewed (0)
Back to top