public final class CollectionExtensions extends Object
CollectionExtensions is an extension class for use with Collection
objects.| Constructor and Description |
|---|
CollectionExtensions() |
| Modifier and Type | Method and Description |
|---|---|
static <T> void |
difference(Collection<T> one,
Collection<T> other)
Removes all of the first given collection's elements that are also contained in the second
given collection.
|
static <T> int |
hashCode(Collection<T[]> arrayObjects)
Returns a hash code based on the contents of the collection that contains array objects.
|
static <T> Collection<T> |
intersection(Collection<T>... toIntersect)
Intersection of the given collections.
|
static <T> boolean |
isEmpty(Collection<T> collection)
Checks if the given
Collection is null or empty. |
static <T> boolean |
isEqualCollection(Collection<T> one,
Collection<T> other)
Compare the given two
Collection objects in equality. |
static <T> boolean |
isNotEmpty(Collection<T> collection)
Checks if the given
Collection is not null or empty |
static <T> Collection<List<T>> |
partition(Collection<T> collection,
int size)
Groups the given
Collection to parts from the specified size. |
static <T> Optional<Boolean> |
preconditionOfEqualCollection(Collection<T> one,
Collection<T> other)
Checks the given two
Collection objects if there are null and return the appropriate
Optional boolean value |
public static <T> boolean isEqualCollection(Collection<T> one, Collection<T> other)
Collection objects in equality.T - the generic type of the elementsone - the oneother - the otherCollection objects are equal otherwise falsepublic static <T> Optional<Boolean> preconditionOfEqualCollection(Collection<T> one, Collection<T> other)
Collection objects if there are null and return the appropriate
Optional boolean valueT - the generic type of the elementsone - the oneother - the otherOptional boolean if value is true both are null, if value is false given two
Collection objects are not equal otherwise the Optional is emptypublic static <T> void difference(Collection<T> one, Collection<T> other)
T - the generic typeone - the collection where the element will be removed if any containing elements existsother - collection containing elements to be removed from the first given collection@SafeVarargs public static <T> Collection<T> intersection(Collection<T>... toIntersect)
Collection.retainAll(Collection) for come to the result.T - the generic typetoIntersect - the to intersectpublic static <T> boolean isNotEmpty(Collection<T> collection)
Collection is not null or emptyT - the generic typecollection - The collection to checkCollection is null or empty otherwise falsepublic static <T> boolean isEmpty(Collection<T> collection)
Collection is null or empty.T - the generic typecollection - The collection to checkCollection is null or empty otherwise false.public static <T> int hashCode(Collection<T[]> arrayObjects)
T - the generic type of the array objectsarrayObjects - the collection that contains array objects whose content-based hash code to
computepublic static <T> Collection<List<T>> partition(Collection<T> collection, int size)
Collection to parts from the specified size.T - the generic typecollection - the collectionsize - the sizeCopyright © 2015–2019 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.