Package org.elasticsearch.common.collect
Class Set
java.lang.Object
org.elasticsearch.common.collect.Set
public class Set
extends java.lang.Object
-
Constructor Summary
Constructors Constructor Description Set()
-
Method Summary
Modifier and Type Method Description static <T> java.util.Set<T>
copyOf(java.util.Collection<? extends T> coll)
Returns an unmodifiableSet
containing the elements of the given Collection.static <T> java.util.Set<T>
of()
Returns an unmodifiable set containing zero elements.static <T> java.util.Set<T>
of(T e1)
Returns an unmodifiable set containing one element.static <T> java.util.Set<T>
of(T... entries)
Returns an unmodifiable set containing an arbitrary number of elements.static <T> java.util.Set<T>
of(T e1, T e2)
Returns an unmodifiable set containing two elements.
-
Constructor Details
-
Set
public Set()
-
-
Method Details
-
of
public static <T> java.util.Set<T> of()Returns an unmodifiable set containing zero elements.- Type Parameters:
T
- theSet
's element type- Returns:
- an empty
Set
-
of
public static <T> java.util.Set<T> of(T e1)Returns an unmodifiable set containing one element.- Type Parameters:
T
- theSet
's element type- Parameters:
e1
- the single element- Returns:
- a
Set
containing the specified element
-
of
public static <T> java.util.Set<T> of(T e1, T e2)Returns an unmodifiable set containing two elements.- Type Parameters:
T
- theSet
's element type- Parameters:
e1
- the first elemente2
- the second element- Returns:
- a
Set
containing the specified element
-
of
@SafeVarargs public static <T> java.util.Set<T> of(T... entries)Returns an unmodifiable set containing an arbitrary number of elements.- Type Parameters:
T
- theSet
's element type- Parameters:
entries
- the elements to be contained in the set- Returns:
- an unmodifiable set containing the specified elements.
-
copyOf
public static <T> java.util.Set<T> copyOf(java.util.Collection<? extends T> coll)Returns an unmodifiableSet
containing the elements of the given Collection.- Type Parameters:
T
- theSet
's element type- Parameters:
coll
- aCollection
from which elements are drawn, must be non-null- Returns:
- a
Set
containing the elements of the givenCollection
- Throws:
java.lang.NullPointerException
- if coll is null, or if it contains any nulls- Since:
- 10
-