Class UnmodifiableSet<E>

  • Type Parameters:
    E - The set element type.
    All Implemented Interfaces:
    java.lang.Iterable<E>, java.util.Collection<E>, java.util.Set<E>

    @Immutable
    public class UnmodifiableSet<E>
    extends UnmodifiableCollection<E>
    implements java.util.Set<E>
    Simple immutable set. This set is order-preserving, so when iterating the elements, they will come in the same order as added. If same value was added multiple times, the first entry counts.
    • Method Detail

      • copyOf

        @Nonnull
        public static <E> UnmodifiableSet<E> copyOf​(E[] array)
      • copyOf

        @Nonnull
        public static <E> UnmodifiableSet<E> copyOf​(java.lang.Iterable<? extends E> iterable)
      • copyOf

        @Nonnull
        public static <E> UnmodifiableSet<E> copyOf​(java.util.Iterator<? extends E> iterator)
      • copyOf

        @Nonnull
        public static <E> UnmodifiableSet<E> copyOf​(java.util.Enumeration<? extends E> enumeration)
      • copyOf

        @Nonnull
        public static <E> UnmodifiableSet<E> copyOf​(java.util.Collection<? extends E> collection)
      • setOf

        @Nonnull
        public static <E> UnmodifiableSet<E> setOf​(E e1,
                                                   E e2)
      • setOf

        @Nonnull
        public static <E> UnmodifiableSet<E> setOf​(E e1,
                                                   E e2,
                                                   E e3)
      • setOf

        @Nonnull
        public static <E> UnmodifiableSet<E> setOf​(E e1,
                                                   E e2,
                                                   E e3,
                                                   E e4)
      • setOf

        @Nonnull
        public static <E> UnmodifiableSet<E> setOf​(E e1,
                                                   E e2,
                                                   E e3,
                                                   E e4,
                                                   E e5)
      • setOf

        @Nonnull
        public static <E> UnmodifiableSet<E> setOf​(E e1,
                                                   E e2,
                                                   E e3,
                                                   E e4,
                                                   E e5,
                                                   E e6)
      • setOf

        @Nonnull
        public static <E> UnmodifiableSet<E> setOf​(E e1,
                                                   E e2,
                                                   E e3,
                                                   E e4,
                                                   E e5,
                                                   E e6,
                                                   E e7)
      • setOf

        @Nonnull
        public static <E> UnmodifiableSet<E> setOf​(E e1,
                                                   E e2,
                                                   E e3,
                                                   E e4,
                                                   E e5,
                                                   E e6,
                                                   E e7,
                                                   E e8)
      • setOf

        @Nonnull
        public static <E> UnmodifiableSet<E> setOf​(E e1,
                                                   E e2,
                                                   E e3,
                                                   E e4,
                                                   E e5,
                                                   E e6,
                                                   E e7,
                                                   E e8,
                                                   E e9)
      • setOf

        @Nonnull
        @SafeVarargs
        public static <E> UnmodifiableSet<E> setOf​(E e1,
                                                   E e2,
                                                   E e3,
                                                   E e4,
                                                   E e5,
                                                   E e6,
                                                   E e7,
                                                   E e8,
                                                   E e9,
                                                   E e10,
                                                   E... more)
      • equals

        public boolean equals​(java.lang.Object obj)
        Specified by:
        equals in interface java.util.Collection<E>
        Specified by:
        equals in interface java.util.Set<E>
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in interface java.util.Collection<E>
        Specified by:
        hashCode in interface java.util.Set<E>
        Overrides:
        hashCode in class java.lang.Object
      • contains

        public boolean contains​(java.lang.Object o)
        Specified by:
        contains in interface java.util.Collection<E>
        Specified by:
        contains in interface java.util.Set<E>
        Overrides:
        contains in class UnmodifiableCollection<E>