Class Sets


  • public class Sets
    extends Object
    General-purpose utilities for working with Set.
    Author:
    AO Industries, Inc.
    • Method Detail

      • union

        public static <E> Set<E> union​(Set<? extends E> set1,
                                       Set<? extends E> set2)
        Combines two sets, maintaining order.
        Parameters:
        set1 - may be null, which will be treated same as an empty set
        set2 - may be null, which will be treated same as an empty set
        See Also:
        LinkedHashSet
      • union

        @SafeVarargs
        public static <E> Set<E> union​(Set<? extends E>... sets)
        Combines multiple sets, maintaining order.
        Parameters:
        sets - may be null, which will be treated same as an empty array. Elements may be null, which will be treated same as an empty set.
        See Also:
        LinkedHashSet
      • union

        @SafeVarargs
        public static <E> Set<E> union​(Set<? extends E> set,
                                       E... elements)
        Combines a set with some new elements, maintaining order.
        Parameters:
        set - may be null, which will be treated same as an empty set
        elements - may be null, which will be treated same as an empty array
        See Also:
        LinkedHashSet