Class Sets
- java.lang.Object
-
- org.elasticsearch.common.util.set.Sets
-
public final class Sets extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> java.util.Set<T>
difference(java.util.Set<T> left, java.util.Set<T> right)
The relative complement, or difference, of the specified left and right set.static <T> boolean
haveEmptyIntersection(java.util.Set<T> left, java.util.Set<T> right)
static <T> java.util.Set<T>
newConcurrentHashSet()
static <T> java.util.HashSet<T>
newHashSet(java.lang.Iterable<T> iterable)
static <T> java.util.HashSet<T>
newHashSet(java.util.Iterator<T> iterator)
static <T> java.util.HashSet<T>
newHashSet(T... elements)
static <T> java.util.SortedSet<T>
sortedDifference(java.util.Set<T> left, java.util.Set<T> right)
The relative complement, or difference, of the specified left and right set, returned as a sorted set.static <T> java.util.Set<T>
union(java.util.Set<T> left, java.util.Set<T> right)
-
-
-
Method Detail
-
newHashSet
public static <T> java.util.HashSet<T> newHashSet(java.util.Iterator<T> iterator)
-
newHashSet
public static <T> java.util.HashSet<T> newHashSet(java.lang.Iterable<T> iterable)
-
newHashSet
public static <T> java.util.HashSet<T> newHashSet(T... elements)
-
newConcurrentHashSet
public static <T> java.util.Set<T> newConcurrentHashSet()
-
haveEmptyIntersection
public static <T> boolean haveEmptyIntersection(java.util.Set<T> left, java.util.Set<T> right)
-
difference
public static <T> java.util.Set<T> difference(java.util.Set<T> left, java.util.Set<T> right)
The relative complement, or difference, of the specified left and right set. Namely, the resulting set contains all the elements that are in the left set but not in the right set. Neither input is mutated by this operation, an entirely new set is returned.- Type Parameters:
T
- the type of the elements of the sets- Parameters:
left
- the left setright
- the right set- Returns:
- the relative complement of the left set with respect to the right set
-
sortedDifference
public static <T> java.util.SortedSet<T> sortedDifference(java.util.Set<T> left, java.util.Set<T> right)
The relative complement, or difference, of the specified left and right set, returned as a sorted set. Namely, the resulting set contains all the elements that are in the left set but not in the right set, and the set is sorted using the natural ordering of element type. Neither input is mutated by this operation, an entirely new set is returned.- Type Parameters:
T
- the type of the elements of the sets- Parameters:
left
- the left setright
- the right set- Returns:
- the sorted relative complement of the left set with respect to the right set
-
union
public static <T> java.util.Set<T> union(java.util.Set<T> left, java.util.Set<T> right)
-
-