Class SetFactory


  • public final class SetFactory
    extends java.lang.Object
    The factory class SetFactory provides factory methods for create new Set objects
    • Constructor Summary

      Constructors 
      Constructor Description
      SetFactory()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> java.util.Set<T> newHashSet​(java.util.Collection<T> collection, T... elements)
      Factory method for create new HashSet and will be returned as Set
      static <T> java.util.Set<T> newHashSet​(T... elements)
      Factory method for create new HashSet and will be returned as Set
      static <T> java.util.Set<T> newInsertionOrderSet​(java.util.Collection<T> collection, T... elements)
      Factory method for create new InsertionOrderSet and will be returned as Set
      static <T> java.util.Set<T> newInsertionOrderSet​(T... elements)
      Factory method for create new InsertionOrderSet and will be returned as Set
      static <T> java.util.Set<T> newLinkedHashSet​(java.util.Collection<T> collection, T... elements)
      Factory method for create new LinkedHashSet and will be returned as Set
      static <T> java.util.Set<T> newLinkedHashSet​(T... elements)
      Factory method for create new LinkedHashSet and will be returned as Set
      static <T> java.util.SortedSet<T> newTreeSet​(@NonNull java.util.Comparator<T> comparator, T... elements)
      Factory method for create new TreeSet and will be returned as Set.
      static <T> java.util.SortedSet<T> newTreeSet​(java.util.Collection<T> collection, java.util.Comparator<T> comparator, T... elements)
      Factory method for create new TreeSet and will be returned as SortedSet
      static <T> java.util.SortedSet<T> newTreeSet​(java.util.Collection<T> collection, T... elements)
      Factory method for create new TreeSet and will be returned as SortedSet.
      static <T> java.util.SortedSet<T> newTreeSet​(T... elements)
      Factory method for create new TreeSet and will be returned as Set
      static <T> java.util.function.Supplier<java.util.SortedSet<T>> newTreeSetSupplier​(@NonNull java.util.Comparator<T> comparator)
      Factory method for create new Supplier for a TreeSet with a Comparator
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SetFactory

        public SetFactory()
    • Method Detail

      • newHashSet

        @SafeVarargs
        public static <T> java.util.Set<T> newHashSet​(T... elements)
        Factory method for create new HashSet and will be returned as Set
        Type Parameters:
        T - the generic type of the elements
        Parameters:
        elements - the elements to add in the new HashSet
        Returns:
        the new HashSet
      • newHashSet

        @SafeVarargs
        public static <T> java.util.Set<T> newHashSet​(java.util.Collection<T> collection,
                                                      T... elements)
        Factory method for create new HashSet and will be returned as Set
        Type Parameters:
        T - the generic type of the elements
        Parameters:
        collection - the optional collection that will be added to the new list
        elements - the elements to add in the new HashSet
        Returns:
        the new HashSet
      • newLinkedHashSet

        @SafeVarargs
        public static <T> java.util.Set<T> newLinkedHashSet​(T... elements)
        Factory method for create new LinkedHashSet and will be returned as Set
        Type Parameters:
        T - the generic type of the elements
        Parameters:
        elements - the elements to add in the new HashSet
        Returns:
        the new LinkedHashSet
      • newLinkedHashSet

        @SafeVarargs
        public static <T> java.util.Set<T> newLinkedHashSet​(java.util.Collection<T> collection,
                                                            T... elements)
        Factory method for create new LinkedHashSet and will be returned as Set
        Type Parameters:
        T - the generic type of the elements
        Parameters:
        collection - the optional collection that will be added to the new list
        elements - the elements to add in the new LinkedHashSet
        Returns:
        the new HashSet
      • newInsertionOrderSet

        @SafeVarargs
        public static <T> java.util.Set<T> newInsertionOrderSet​(T... elements)
        Factory method for create new InsertionOrderSet and will be returned as Set
        Type Parameters:
        T - the generic type of the elements
        Parameters:
        elements - the elements to add in the new InsertionOrderSet
        Returns:
        the new InsertionOrderSet
      • newInsertionOrderSet

        @SafeVarargs
        public static <T> java.util.Set<T> newInsertionOrderSet​(java.util.Collection<T> collection,
                                                                T... elements)
        Factory method for create new InsertionOrderSet and will be returned as Set
        Type Parameters:
        T - the generic type of the elements
        Parameters:
        collection - the optional collection that will be added to the new list
        elements - the elements to add in the new InsertionOrderSet
        Returns:
        the new InsertionOrderSet
      • newTreeSet

        @SafeVarargs
        public static <T> java.util.SortedSet<T> newTreeSet​(T... elements)
        Factory method for create new TreeSet and will be returned as Set
        Type Parameters:
        T - the generic type of the elements
        Parameters:
        elements - the elements to add in the new TreeSet
        Returns:
        the new SortedSet
      • newTreeSet

        @SafeVarargs
        public static <T> java.util.SortedSet<T> newTreeSet​(@NonNull
                                                            @NonNull java.util.Comparator<T> comparator,
                                                            T... elements)
        Factory method for create new TreeSet and will be returned as Set.
        Type Parameters:
        T - the generic type of the elements
        Parameters:
        comparator - the comparator
        elements - the elements to add in the new TreeSet
        Returns:
        the new SortedSet
      • newTreeSet

        @SafeVarargs
        public static <T> java.util.SortedSet<T> newTreeSet​(java.util.Collection<T> collection,
                                                            T... elements)
        Factory method for create new TreeSet and will be returned as SortedSet.
        Type Parameters:
        T - the generic type of the elements
        Parameters:
        collection - the optional collection that will be added to the new list
        elements - the elements to add in the new TreeSet
        Returns:
        the new SortedSet
      • newTreeSet

        @SafeVarargs
        public static <T> java.util.SortedSet<T> newTreeSet​(java.util.Collection<T> collection,
                                                            java.util.Comparator<T> comparator,
                                                            T... elements)
        Factory method for create new TreeSet and will be returned as SortedSet
        Type Parameters:
        T - the generic type of the elements
        Parameters:
        collection - the optional collection that will be added to the new list
        comparator - the comparator
        elements - the elements to add in the new TreeSet
        Returns:
        the new TreeSet
      • newTreeSetSupplier

        public static <T> java.util.function.Supplier<java.util.SortedSet<T>> newTreeSetSupplier​(@NonNull
                                                                                                 @NonNull java.util.Comparator<T> comparator)
        Factory method for create new Supplier for a TreeSet with a Comparator
        Type Parameters:
        T - the generic type of the elements
        Parameters:
        comparator - the comparator
        Returns:
        the new Supplier