Class Sets
java.lang.Object
org.elasticsearch.common.util.set.Sets
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Set<T>
difference(Set<T> left, Set<T> right)
The relative complement, or difference, of the specified left and right set.static <T> boolean
haveEmptyIntersection(Set<T> left, Set<T> right)
static <T> boolean
haveNonEmptyIntersection(Set<T> left, Set<T> right)
static <T> Set<T>
intersection(Set<T> set1, Set<T> set2)
static <T> Set<T>
static <T> HashSet<T>
newHashSet(Iterable<T> iterable)
static <T> HashSet<T>
newHashSet(Iterator<T> iterator)
static <T> HashSet<T>
newHashSet(T... elements)
static <T> SortedSet<T>
sortedDifference(Set<T> left, Set<T> right)
The relative complement, or difference, of the specified left and right set, returned as a sorted set.Returns aCollector
that accumulates the input elements into a sorted set.Returns aCollector
that accumulates the input elements into a sorted set and finishes the resulting set into an unmodifiable set.static <T> Set<T>
-
Method Details
-
newHashSet
-
newHashSet
-
newHashSet
-
newConcurrentHashSet
-
haveEmptyIntersection
-
haveNonEmptyIntersection
-
difference
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
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
-
toSortedSet
Returns aCollector
that accumulates the input elements into a sorted set.- Type Parameters:
T
- the type of the input elements- Returns:
- a sorted set
-
toUnmodifiableSortedSet
Returns aCollector
that accumulates the input elements into a sorted set and finishes the resulting set into an unmodifiable set. The resulting read-only view through the unmodifiable set is a sorted set.- Type Parameters:
T
- the type of the input elements- Returns:
- an unmodifiable set where the underlying set is sorted
-
union
-
intersection
-