Interface ImmutableSet<E>

    • Method Detail

      • toSet

        Set<E> toSet()
        Returns a modifiable copy of this immutable set.
        Returns:
        a modifiable copy of this immutable set.
      • equals

        boolean equals​(Object obj)
        Force to redefine equals for the implementations of immutable collection classes.
        Specified by:
        equals in interface ImmutableCollection<E>
        Overrides:
        equals in class Object
        Parameters:
        obj - Object; the object to compare this collection with
        Returns:
        whether the objects are equal
      • hashCode

        int hashCode()
        Force to redefine hashCode for the implementations of immutable collection classes.
        Specified by:
        hashCode in interface ImmutableCollection<E>
        Overrides:
        hashCode in class Object
        Returns:
        the calculated hashCode
      • toString

        String toString()
        Force to redefine toString.
        Overrides:
        toString in class Object
        Returns:
        String; a description of this immutable set
      • of

        static <E> ImmutableSet<E> of()
        Return an empty ImmutableSet, backed by a LinkedHashSet.
        Type Parameters:
        E - the value type
        Returns:
        ImmutableSet<K, V>; an empty ImmutableSet
      • of

        static <E> ImmutableSet<E> of​(E v1)
        Return an ImmutableSet with 1 entry, backed by a LinkedHashSet.
        Type Parameters:
        E - the value type
        Parameters:
        v1 - E; value 1
        Returns:
        ImmutableSet<K, V>; an ImmutableSet with 1 entry, backed by a LinkedHashSet
      • of

        static <E> ImmutableSet<E> of​(E v1,
                                      E v2)
        Return an ImmutableSet with 2 entries, backed by a LinkedHashSet.
        Type Parameters:
        E - the value type
        Parameters:
        v1 - E; value 1
        v2 - E; value 2
        Returns:
        ImmutableSet<K, V>; an ImmutableSet with 2 entries, backed by a LinkedHashSet
      • of

        static <E> ImmutableSet<E> of​(E v1,
                                      E v2,
                                      E v3)
        Return an ImmutableSet with 3 entries, backed by a LinkedHashSet.
        Type Parameters:
        E - the value type
        Parameters:
        v1 - E; value 1
        v2 - E; value 2
        v3 - E; value 3
        Returns:
        ImmutableSet<K, V>; an ImmutableSet with 3 entries, backed by a LinkedHashSet
      • of

        static <E> ImmutableSet<E> of​(E v1,
                                      E v2,
                                      E v3,
                                      E v4)
        Return an ImmutableSet with 4 entries, backed by a LinkedHashSet.
        Type Parameters:
        E - the value type
        Parameters:
        v1 - E; value 1
        v2 - E; value 2
        v3 - E; value 3
        v4 - E; value 4
        Returns:
        ImmutableSet<K, V>; an ImmutableSet with 4 entries, backed by a LinkedHashSet
      • of

        static <E> ImmutableSet<E> of​(E v1,
                                      E v2,
                                      E v3,
                                      E v4,
                                      E v5,
                                      E... vn)
        Return an ImmutableSet with 5 or more entries, backed by a LinkedHashSet.
        Type Parameters:
        E - the value type
        Parameters:
        v1 - E; value 1
        v2 - E; value 2
        v3 - E; value 3
        v4 - E; value 4
        v5 - E; value 5
        vn - E...; values 6 and beyond
        Returns:
        ImmutableSet<K, V>; an ImmutableSet with 5 or more entries, backed by a LinkedHashSet