Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 6 of 6 for SingletonImmutableSet (0.16 sec)

  1. guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/SingletonImmutableSet.java

    import org.jspecify.annotations.Nullable;
    
    /**
     * GWT emulation of {@link SingletonImmutableSet}.
     *
     * @author Hayward Chan
     */
    final class SingletonImmutableSet<E> extends ImmutableSet<E> {
      private final E element;
    
      SingletonImmutableSet(E element) {
        this.element = checkNotNull(element);
      }
    
      @Override
      public int size() {
        return 1;
      }
    
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Tue Jul 01 22:23:20 UTC 2025
    - 1.2K bytes
    - Viewed (0)
  2. android/guava/src/com/google/common/collect/SingletonImmutableSet.java

    @SuppressWarnings("serial") // uses writeReplace(), not default serialization
    final class SingletonImmutableSet<E> extends ImmutableSet<E> {
      // We deliberately avoid caching the asList and hashCode here, to ensure that with
      // compressed oops, a SingletonImmutableSet packs all the way down to the optimal 16 bytes.
    
      final transient E element;
    
      SingletonImmutableSet(E element) {
        this.element = Preconditions.checkNotNull(element);
      }
    
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Thu Aug 07 16:05:33 UTC 2025
    - 2.4K bytes
    - Viewed (0)
  3. guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableSet.java

      @SuppressWarnings({"unchecked"})
      public static <E> ImmutableSet<E> of() {
        return (ImmutableSet<E>) RegularImmutableSet.EMPTY;
      }
    
      public static <E> ImmutableSet<E> of(E e1) {
        return new SingletonImmutableSet<E>(e1);
      }
    
      @SuppressWarnings("unchecked")
      public static <E> ImmutableSet<E> of(E e1, E e2) {
        return create(e1, e2);
      }
    
      @SuppressWarnings("unchecked")
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Wed Aug 06 18:32:41 UTC 2025
    - 8.3K bytes
    - Viewed (0)
  4. android/guava-tests/test/com/google/common/collect/ImmutableSetTest.java

        return ImmutableSet.copyOf(elements);
      }
    
      public void testCreation_allDuplicates() {
        ImmutableSet<String> set = ImmutableSet.copyOf(Lists.newArrayList("a", "a"));
        assertTrue(set instanceof SingletonImmutableSet);
        assertEquals(Lists.newArrayList("a"), new ArrayList<>(set));
      }
    
      public void testCreation_oneDuplicate() {
        // now we'll get the varargs overload
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Thu Aug 07 16:05:33 UTC 2025
    - 14.1K bytes
    - Viewed (0)
  5. guava-tests/test/com/google/common/collect/ImmutableSetTest.java

        return ImmutableSet.copyOf(elements);
      }
    
      public void testCreation_allDuplicates() {
        ImmutableSet<String> set = ImmutableSet.copyOf(Lists.newArrayList("a", "a"));
        assertTrue(set instanceof SingletonImmutableSet);
        assertEquals(Lists.newArrayList("a"), new ArrayList<>(set));
      }
    
      public void testCreation_oneDuplicate() {
        // now we'll get the varargs overload
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Thu Aug 07 16:05:33 UTC 2025
    - 14.2K bytes
    - Viewed (0)
  6. guava/src/com/google/common/collect/ImmutableSet.java

       * Collections#singleton} for code consistency, {@code null} rejection, and because the return
       * type conveys the immutability guarantee.
       */
      public static <E> ImmutableSet<E> of(E e1) {
        return new SingletonImmutableSet<>(e1);
      }
    
      /*
       * TODO: b/315526394 - Skip the Builder entirely for the of(...) methods, since we don't need to
       * worry that we might trigger the fallback to the JDK-backed implementation? (The varargs one
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Thu Aug 07 16:05:33 UTC 2025
    - 35.2K bytes
    - Viewed (0)
Back to top