Class Sets

java.lang.Object
com.aoapps.collections.Sets

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

    Modifier and Type
    Method
    Description
    static <E> Set<E>
    union(Set<? extends E>... sets)
    Combines multiple sets, maintaining order.
    static <E> Set<E>
    union(Set<? extends E> set, E... elements)
    Combines a set with some new elements, maintaining order.
    static <E> Set<E>
    union(Set<? extends E> set1, Set<? extends E> set2)
    Combines two sets, maintaining order.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • 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:
    • 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:
    • 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: