|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.omnaest.utils.structure.collection.set.SetUtils
public class SetUtils
Helper for Set types
CollectionUtils| Constructor Summary | |
|---|---|
SetUtils()
|
|
| Method Summary | ||
|---|---|---|
static
|
adapter(List<E> list)
Returns a new ListToSetAdapter for the given List |
|
static
|
adapter(Set<FROM> set,
ElementBidirectionalConverter<FROM,TO> elementBidirectionalConverter)
Returns a new SetToSetAdapter for the given Set |
|
static
|
add(Set<E> set,
E... elements)
Returns the given Set, or a new instance if the given Set is null. |
|
static
|
addAll(Set<? extends E> set,
Iterable<? extends E> elementIterable)
Adds the elements from the given Iterable to the given Set. |
|
static
|
composite(Collection<Set<E>> setCollection)
Returns a SetComposite instance for the given Sets |
|
static
|
composite(Set<E>... sets)
Returns a SetComposite instance for the given Sets |
|
static
|
convert(ElementConverter<FROM,TO> elementConverter,
FROM... elements)
Transforms elements to a Set of instances of another type using a given ElementConverter. |
|
static
|
convert(Iterable<FROM> iterable,
ElementConverter<FROM,TO> elementConverter)
Transforms a given Collection instance from one generic type into the other using a given ElementConverter. |
|
static
|
delta(Set<E> firstSet,
Set<E> secondSet)
Returns a new SetDelta instance for the given Sets |
|
static
|
emptySet()
Returns a new LinkedHashSet instance |
|
static
|
filter(Iterable<E> iterable,
ElementFilter<E> elementFilter)
Filters the given Iterable and returns a Set which only contains the elements which are not filtered out by
the given ElementFilter. |
|
static
|
intersection(Collection<? extends Collection<E>> collectionOfCollections)
Returns the intersection of the Collections of the given container Collection |
|
static
|
intersection(Collection<E>... collections)
Returns the intersection of the Collections of the given container Collection |
|
static
|
intersection(Collection<E> collectionFirst,
Collection<E> collectionSecond)
Returns the intersection of the Collections of the given container Collection |
|
static
|
intersection(Set<E> set1,
Set<E> set2)
Returns the intersection of two given Set instances by iterating over the smaller given Set and testing on
the Set.contains(Object) method of the larger Set. |
|
static boolean |
isSetType(Class<?> type)
Returns true if the given type is assignable to the Set interface |
|
static boolean |
isSortedSetType(Class<?> type)
Returns true if the given type is assignable to the SortedSet interface |
|
static
|
locked(Set<E> set,
Lock lock)
Returns a view of the given Set using the given Lock to synchronize all of its methods |
|
static
|
lockedByReentrantLock(Set<E> set)
Returns a view of the given Set using a new ReentrantLock instance to synchronize all of its methods |
|
static
|
mergeAll(Collection<? extends Collection<E>> collectionOfCollections)
Merges all elements of the given Collection instances into one single Set instance . |
|
static
|
mergeAll(Collection<E>... collections)
Merges all elements of the given Collection instances into one single Set instance. |
|
static
|
remove(Set<E> set,
E element)
Removes the given element from the given Set instance. |
|
static
|
removeAll(Set<E> set,
Iterable<? extends E> removingIterable)
Returns the given Set instance reduced by the elements of the given Iterable |
|
static
|
removeAllAsNewSet(Set<E> set,
Iterable<E> removingIterable)
Returns a new Set instance containing the elements of the given Set reduced by the elements of the given
Iterable |
|
static
|
retainAll(Set<E> set,
Collection<? extends E> retainableCollection)
Does call Set.retainAll(Collection) on the given Set instance. |
|
static
|
valueOf(E... elements)
Same as valueOf(Iterable) for one or more elements |
|
static
|
valueOf(Iterable<E> iterable)
Returns a new LinkedHashSet instance with the element of the given Iterable which keeps the order of the
elements |
|
static
|
valueOf(Iterator<E> iterator)
Similar to valueOf(Iterable) |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SetUtils()
| Method Detail |
|---|
public static <E> SetDelta<E> delta(Set<E> firstSet,
Set<E> secondSet)
SetDelta instance for the given Sets
firstSet - secondSet -
SetDelta instanceMapUtils.delta(java.util.Map, java.util.Map)
public static <E> Set<E> removeAll(Set<E> set,
Iterable<? extends E> removingIterable)
Set instance reduced by the elements of the given Iterable
set - SetremovingIterable - Iterable
Set instance or null, if null is given
public static <E> Set<E> remove(Set<E> set,
E element)
Set instance.
set - element -
Set instance or null if null is given
public static <E> Set<E> removeAllAsNewSet(Set<E> set,
Iterable<E> removingIterable)
Set instance containing the elements of the given Set reduced by the elements of the given
Iterable
set - SetremovingIterable - Iterable
Set instance always
public static <E> Set<E> add(Set<E> set,
E... elements)
Set, or a new instance if the given Set is null. The returned Set will have the
given elements added.
set - elements -
Set or new instance if null
public static <E> Set<E> addAll(Set<? extends E> set,
Iterable<? extends E> elementIterable)
Iterable to the given Set. If the given Set is null, a new
LinkedHashSet is returned. If the given Iterable is null, nothing is added.
set - SetelementIterable - Iterable
Set instance or new LinkedHashSet
public static <E> Set<E> retainAll(Set<E> set,
Collection<? extends E> retainableCollection)
Set.retainAll(Collection) on the given Set instance. If null is given as Set null is
returned as result. If null is given as retainable element Collection the given Set is cleared.
set - retainableCollection -
public static <E> Set<E> mergeAll(Collection<E>... collections)
Collection instances into one single Set instance.
E - collections -
mergeAll(Collection)public static <E> Set<E> mergeAll(Collection<? extends Collection<E>> collectionOfCollections)
Collection instances into one single Set instance .
E - collectionOfCollections -
mergeAll(Collection...)public static <E> Set<E> intersection(Collection<? extends Collection<E>> collectionOfCollections)
Collections of the given container Collection
collectionOfCollections -
public static <E> Set<E> intersection(Set<E> set1,
Set<E> set2)
Set instances by iterating over the smaller given Set and testing on
the Set.contains(Object) method of the larger Set.
set1 - set2 -
Set instancepublic static <E> Set<E> intersection(Collection<E>... collections)
Collections of the given container Collection
collections -
public static <E> Set<E> intersection(Collection<E> collectionFirst,
Collection<E> collectionSecond)
Collections of the given container Collection
collectionFirst - collectionSecond -
Set instancepublic static <E> Set<E> valueOf(E... elements)
valueOf(Iterable) for one or more elements
elements -
LinkedHashSet instance containing all given elementspublic static <E> Set<E> emptySet()
LinkedHashSet instance
public static <E> Set<E> valueOf(Iterator<E> iterator)
valueOf(Iterable)
iterator -
public static <E> Set<E> valueOf(Iterable<E> iterable)
LinkedHashSet instance with the element of the given Iterable which keeps the order of the
elements
iterable -
public static <E> Set<E> locked(Set<E> set,
Lock lock)
Set using the given Lock to synchronize all of its methods
set - lock -
lockedByReentrantLock(Set)public static <E> Set<E> lockedByReentrantLock(Set<E> set)
Set using a new ReentrantLock instance to synchronize all of its methods
set -
locked(Set, Lock)
public static <FROM,TO> Set<TO> convert(ElementConverter<FROM,TO> elementConverter,
FROM... elements)
Set of instances of another type using a given ElementConverter.
elementConverter - elements - convert(Iterable, ElementConverter)
public static <FROM,TO> Set<TO> convert(Iterable<FROM> iterable,
ElementConverter<FROM,TO> elementConverter)
Collection instance from one generic type into the other using a given ElementConverter.
iterable - elementConverter -
public static <E> Set<E> filter(Iterable<E> iterable,
ElementFilter<E> elementFilter)
Iterable and returns a Set which only contains the elements which are not filtered out by
the given ElementFilter.
iterable - IterableelementFilter - ElementFilter
Set instance
public static <FROM,TO> Set<TO> adapter(Set<FROM> set,
ElementBidirectionalConverter<FROM,TO> elementBidirectionalConverter)
SetToSetAdapter for the given Set
set - SetelementBidirectionalConverter - ElementBidirectionalConverter
SetToSetAdapter instancepublic static <E> Set<E> adapter(List<E> list)
ListToSetAdapter for the given List
list - List
Set adapter instancepublic static <E> Set<E> composite(Set<E>... sets)
SetComposite instance for the given Sets
sets -
public static <E> Set<E> composite(Collection<Set<E>> setCollection)
SetComposite instance for the given Sets
setCollection -
public static boolean isSetType(Class<?> type)
Set interface
type -
isSortedSetType(Class)public static boolean isSortedSetType(Class<?> type)
SortedSet interface
type -
isSetType(Class)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||