| Modifier and Type | Class and Description |
|---|---|
| public abstract static class |
| Modifier and Type | Field and Description |
|---|---|
| public static final SortedSet | EMPTY_SORTED_SET
An empty unmodifiable sorted set. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static < the generic type that is able to represent the types contained
in both input sets. E> SetUtils. | Returns: a view of the relative complement of of the two setsthe set to subtract from, must not be null a, final Set<? extends E> the set to subtract, must not be null b)Returns a unmodifiable view containing the difference of the given
|
| public static < the generic type that is able to represent the types contained
in both input sets. E> SetUtils. | Returns: a view of the symmetric difference of the two setsthe first set, must not be null a, final Set<? extends E> the second set, must not be null b)Returns a unmodifiable view of the symmetric difference of the given
|
| public static < the element type T> Set | Returns: an empty set if the argument isnullthe set, possibly set)nullReturns an immutable empty set if the argument is |
| public static < the element type E> Set | |
| public static < the element type E> SortedSet | |
| public static < the element type T> int | Returns: the hash codethe set to calculate the hash code for, may be null set)Generates a hash code using the algorithm specified in
|
| public static < the element type E> HashSet | Returns: a setthe elements that make up the new set items)Creates a set from the given items. |
| public static < the generic type that is able to represent the types contained
in both input sets. E> SetUtils. | Returns: a view of the intersection of the two setsthe first set, must not be null a, final Set<? extends E> the second set, must not be null b)Returns a unmodifiable view of the intersection of the given |
| public static boolean | Returns: whether the sets are equal by value comparisonthe first set, may be null set1, final Collection<?> the second set, may be null set2)Tests two sets for equality as per the |
| public static < the element type E> Set | Returns: a new identity hash setReturns a new hash set that matches elements based on |
| public static < the element type E> Set | Returns: an ordered set backed by the given setthe set to order, must not be null set)Returns a set that maintains the order of elements that are added backed by the given set. |
| public static < the element type E> SortedSet | Returns: a predicated navigable set backed by the given navigable setthe navigable set to predicate, must not be null set, final Predicate<? super E> the predicate for the navigable set, must not be null predicate)Returns a predicated (validating) navigable set backed by the given navigable set. |
| public static < the element type E> Set | Returns: a predicated set backed by the given setthe set to predicate, must not be null set, final Predicate<? super E> the predicate for the set, must not be null predicate)Returns a predicated (validating) set backed by the given set. |
| public static < the element type E> SortedSet | Returns: a predicated sorted set backed by the given sorted setthe sorted set to predicate, must not be null set, final Predicate<? super E> the predicate for the sorted set, must not be null predicate)Returns a predicated (validating) sorted set backed by the given sorted set. |
| public static < the element type E> Set | Returns: a synchronized set backed by the given setthe set to synchronize, must not be null set)Returns a synchronized set backed by the given set. |
| public static < the element type E> SortedSet | Returns: a synchronized set backed by the given setthe sorted set to synchronize, must not be null set)Returns a synchronized sorted set backed by the given sorted set. |
| public static < the element type E> SortedSet | Returns: a transformed set backed by the given setthe navigable set to transform, must not be null set, final Transformer<? super E, ? extends E> the transformer for the set, must not be null transformer)Returns a transformed navigable set backed by the given navigable set. |
| public static < the element type E> Set | Returns: a transformed set backed by the given setthe set to transform, must not be null set, final Transformer<? super E, ? extends E> the transformer for the set, must not be null transformer)Returns a transformed set backed by the given set. |
| public static < the element type E> SortedSet | Returns: a transformed set backed by the given setthe set to transform, must not be null set, final Transformer<? super E, ? extends E> the transformer for the set, must not be null transformer)Returns a transformed sorted set backed by the given set. |
| public static < the generic type that is able to represent the types contained
in both input sets. E> SetUtils. | |
| public static < the element type E> SortedSet | Returns: an unmodifiable set backed by the given setthe navigable set to make unmodifiable, must not be null set)Returns an unmodifiable navigable set backed by the given navigable set. |
| public static < the element type E> Set | Returns: a setthe elements that make up the new set items)Creates an unmodifiable set from the given items. |
| public static < the element type E> Set | Returns: an unmodifiable set backed by the given setthe set to make unmodifiable, must not be null set)Returns an unmodifiable set backed by the given set. |
| public static < the element type E> SortedSet | Returns: an unmodifiable set backed by the given setthe sorted set to make unmodifiable, must not be null set)Returns an unmodifiable sorted set backed by the given sorted set. |
| EMPTY_SORTED_SET | back to summary |
|---|---|
| public static final SortedSet<E> EMPTY_SORTED_SET An empty unmodifiable sorted set. This is not provided in the JDK.
| |
| SetUtils | back to summary |
|---|---|
| private SetUtils()
| |
| difference | back to summary |
|---|---|
| public static <E> SetUtils. Returns a unmodifiable view containing the difference of the given
The returned view contains all elements of | |
| disjunction | back to summary |
|---|---|
| public static <E> SetUtils. Returns a unmodifiable view of the symmetric difference of the given
The returned view contains all elements of
This is equivalent to | |
| emptyIfNull | back to summary |
|---|---|
| public static <T> Set Returns an immutable empty set if the argument is | |
| emptySet | back to summary |
|---|---|
| public static <E> Set Get a typed empty unmodifiable Set.
| |
| emptySortedSet | back to summary |
|---|---|
| public static <E> SortedSet Get a typed empty unmodifiable sorted set.
| |
| hashCodeForSet | back to summary |
|---|---|
| public static <T> int hashCodeForSet(final Collection<T> set) Generates a hash code using the algorithm specified in
This method is useful for implementing
| |
| hashSet | back to summary |
|---|---|
| public static <E> HashSet Creates a set from the given items. If the passed var-args argument is
| |
| intersection | back to summary |
|---|---|
| public static <E> SetUtils. Returns a unmodifiable view of the intersection of the given
The returned view contains all elements that are members of both input sets
( | |
| isEqualSet | back to summary |
|---|---|
| public static boolean isEqualSet(final Collection<?> set1, final Collection<?> set2) Tests two sets for equality as per the
This method is useful for implementing The relevant text (slightly paraphrased as this is a static method) is:
| |
| newIdentityHashSet | back to summary |
|---|---|
| public static <E> Set Returns a new hash set that matches elements based on
This set will violate the detail of various Set contracts.
As a general rule, don't compare this set to other sets. In particular, you can't
use decorators like
Note that the returned set is not synchronized and is not thread-safe.
If you wish to use this set from multiple threads concurrently, you must use
appropriate synchronization. The simplest approach is to wrap this map
using
| |
| orderedSet | back to summary |
|---|---|
| public static <E> Set Returns a set that maintains the order of elements that are added backed by the given set. If an element is added twice, the order is determined by the first add. The order is observed through the iterator or toArray.
| |
| predicatedNavigableSet | back to summary |
|---|---|
| public static <E> SortedSet Returns a predicated (validating) navigable set backed by the given navigable set. Only objects that pass the test in the given predicate can be added to the set. Trying to add an invalid object results in an IllegalArgumentException. It is important not to use the original set after invoking this method, as it is a backdoor for adding invalid objects.
| |
| predicatedSet | back to summary |
|---|---|
| public static <E> Set Returns a predicated (validating) set backed by the given set. Only objects that pass the test in the given predicate can be added to the set. Trying to add an invalid object results in an IllegalArgumentException. It is important not to use the original set after invoking this method, as it is a backdoor for adding invalid objects.
| |
| predicatedSortedSet | back to summary |
|---|---|
| public static <E> SortedSet Returns a predicated (validating) sorted set backed by the given sorted set. Only objects that pass the test in the given predicate can be added to the set. Trying to add an invalid object results in an IllegalArgumentException. It is important not to use the original set after invoking this method, as it is a backdoor for adding invalid objects.
| |
| synchronizedSet | back to summary |
|---|---|
| public static <E> Set Returns a synchronized set backed by the given set. You must manually synchronize on the returned set's iterator to avoid non-deterministic behavior:
Set s = SetUtils.synchronizedSet(mySet);
synchronized (s) {
Iterator i = s.iterator();
while (i.hasNext()) {
process (i.next());
}
}
This method is just a wrapper for Collections#synchronizedSet(Set).
| |
| synchronizedSortedSet | back to summary |
|---|---|
| public static <E> SortedSet Returns a synchronized sorted set backed by the given sorted set. You must manually synchronize on the returned set's iterator to avoid non-deterministic behavior:
Set s = SetUtils.synchronizedSortedSet(mySet);
synchronized (s) {
Iterator i = s.iterator();
while (i.hasNext()) {
process (i.next());
}
}
This method is just a wrapper for Collections#synchronizedSortedSet(SortedSet).
| |
| transformedNavigableSet | back to summary |
|---|---|
| public static <E> SortedSet Returns a transformed navigable set backed by the given navigable set. Each object is passed through the transformer as it is added to the Set. It is important not to use the original set after invoking this method, as it is a backdoor for adding untransformed objects.
Existing entries in the specified set will not be transformed.
If you want that behaviour, see
| |
| transformedSet | back to summary |
|---|---|
| public static <E> Set Returns a transformed set backed by the given set. Each object is passed through the transformer as it is added to the Set. It is important not to use the original set after invoking this method, as it is a backdoor for adding untransformed objects.
Existing entries in the specified set will not be transformed.
If you want that behaviour, see
| |
| transformedSortedSet | back to summary |
|---|---|
| public static <E> SortedSet Returns a transformed sorted set backed by the given set. Each object is passed through the transformer as it is added to the Set. It is important not to use the original set after invoking this method, as it is a backdoor for adding untransformed objects.
Existing entries in the specified set will not be transformed.
If you want that behaviour, see
| |
| union | back to summary |
|---|---|
| public static <E> SetUtils. Returns a unmodifiable view of the union of the given
The returned view contains all elements of
| |
| unmodifiableNavigableSet | back to summary |
|---|---|
| public static <E> SortedSet Returns an unmodifiable navigable set backed by the given navigable set. This method uses the implementation in the decorators subpackage.
| |
| unmodifiableSet | back to summary |
|---|---|
| public static <E> Set Creates an unmodifiable set from the given items. If the passed var-args argument is
| |
| unmodifiableSet | back to summary |
|---|---|
| public static <E> Set Returns an unmodifiable set backed by the given set. This method uses the implementation in the decorators subpackage.
| |
| unmodifiableSortedSet | back to summary |
|---|---|
| public static <E> SortedSet Returns an unmodifiable sorted set backed by the given sorted set. This method uses the implementation in the decorators subpackage.
| |
If the decorated sets change, this view will change as well. The contents
of this view can be transferred to another instance via the copyInto(Set)
and toSet() methods.
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public < the set type S extends Set | copyInto(final S
the set for copying the contents set)Copies the contents of this view into the provided set. |
| protected abstract Iterator | Returns: a new iterator for this viewReturn an iterator for this view; the returned iterator is not required to be unmodifiable. |
| public Iterator | iterator()
Implements abstract java. Implements java. |
| public int | size()
Implements abstract java. Implements java. |
| public Set | Returns: a new set containing all elements of this viewReturns a new set containing the contents of this view. |
| SetView | back to summary |
|---|---|
| public SetView() | |
| copyInto | back to summary |
|---|---|
| public <S extends Set Copies the contents of this view into the provided set.
| |
| createIterator | back to summary |
|---|---|
| protected abstract Iterator Return an iterator for this view; the returned iterator is not required to be unmodifiable.
| |
| iterator | back to summary |
|---|---|
| public Iterator Implements abstract java. Implements java. Doc from java. Returns an iterator over the elements in this set. The elements are returned in no particular order (unless this set is an instance of some class that provides a guarantee). | |
| size | back to summary |
|---|---|
| public int size() Implements abstract java. Implements java. Doc from java. Returns the number of elements in this set (its cardinality). If this
set contains more than
| |
| toSet | back to summary |
|---|---|
| public Set Returns a new set containing the contents of this view.
| |