public class Sets
extends java.lang.Object
| Constructor and Description |
|---|
Sets() |
| Modifier and Type | Method and Description |
|---|---|
static <E> java.util.HashSet<E> |
newHashSet()
Creates a mutable, empty
HashSet instance. |
static <E> java.util.HashSet<E> |
newHashSet(E... elements)
Creates a mutable
HashSet instance containing the given elements in unspecified order. |
static <E> java.util.HashSet<E> |
newHashSet(java.lang.Iterable<? extends E> elements)
Creates a mutable
HashSet instance containing the given elements in unspecified order. |
static <E> java.util.HashSet<E> |
newHashSet(java.util.Iterator<? extends E> elements)
Creates a mutable
HashSet instance containing the given elements in unspecified order. |
static <E> java.util.LinkedHashSet<E> |
newLinkedHashSet()
Creates a mutable, empty
LinkedHashSet instance. |
static <E> java.util.LinkedHashSet<E> |
newLinkedHashSet(java.lang.Iterable<? extends E> elements)
Creates a mutable
LinkedHashSet instance containing the given elements in order. |
static <E extends java.lang.Comparable<?>> |
newTreeSet()
Creates a mutable, empty
TreeSet instance sorted by the natural sort ordering of its elements. |
static <E extends java.lang.Comparable<?>> |
newTreeSet(java.lang.Iterable<? extends E> elements)
Creates a mutable
TreeSet instance containing the given elements sorted by their natural ordering. |
public static <E> java.util.HashSet<E> newHashSet()
HashSet instance.HashSet@SafeVarargs public static <E> java.util.HashSet<E> newHashSet(E... elements)
HashSet instance containing the given elements in unspecified order.elements - the elements that the set should containHashSet containing those elements (minus duplicates)public static <E> java.util.HashSet<E> newHashSet(java.lang.Iterable<? extends E> elements)
HashSet instance containing the given elements in unspecified order.elements - the elements that the set should containHashSet containing those elements (minus duplicates)public static <E> java.util.HashSet<E> newHashSet(java.util.Iterator<? extends E> elements)
HashSet instance containing the given elements in unspecified order.elements - the elements that the set should containHashSet containing those elements (minus duplicates)public static <E> java.util.LinkedHashSet<E> newLinkedHashSet()
LinkedHashSet instance.LinkedHashSetpublic static <E> java.util.LinkedHashSet<E> newLinkedHashSet(java.lang.Iterable<? extends E> elements)
LinkedHashSet instance containing the given elements in order.elements - the elements that the set should contain, in orderLinkedHashSet containing those elements (minus duplicates)public static <E extends java.lang.Comparable<?>> java.util.TreeSet<E> newTreeSet()
TreeSet instance sorted by the natural sort ordering of its elements.TreeSetpublic static <E extends java.lang.Comparable<?>> java.util.TreeSet<E> newTreeSet(java.lang.Iterable<? extends E> elements)
TreeSet instance containing the given elements sorted by their natural ordering.elements - the elements that the set should containTreeSet containing those elements (minus duplicates)