Modifier and Type
Method and Description
static <C> boolean
addAllCollection<C> collection,
C... elements)
Adds all elements in the array to the given collection.
static <C> boolean
addAllCollection<C> collection,
Enumeration<? extends C> enumeration)
Adds all elements in the enumeration to the given collection.
static <C> boolean
addAllCollection<C> collection,
Iterable<? extends C> iterable)
Adds all elements in the Iterable
to the given collection.
static <C> boolean
addAllCollection<C> collection,
Iterator<? extends C> iterator)
Adds all elements in the iteration to the given collection.
static <T> boolean
addIgnoreNullCollection<T> collection,
T object)
Adds an element to the collection unless the element is null.
static <O> int
cardinalityIterable<? super O> coll)
Deprecated.
static <O extends Comparable<? super O>>
List<O>
collateIterable<? extends O> a,
Iterable<? extends O> b)
Merges two sorted Collections, a and b, into a single, sorted List
such that the natural ordering of the elements is retained.
static <O extends Comparable<? super O>>
List<O>
collateIterable<? extends O> a,
Iterable<? extends O> b,
boolean includeDuplicates)
Merges two sorted Collections, a and b, into a single, sorted List
such that the natural ordering of the elements is retained.
static <O> List<O>
collateIterable<? extends O> a,
Iterable<? extends O> b,
Comparator<? super O> c)
Merges two sorted Collections, a and b, into a single, sorted List
such that the ordering of the elements according to Comparator c is retained.
static <O> List<O>
collateIterable<? extends O> a,
Iterable<? extends O> b,
Comparator<? super O> c,
boolean includeDuplicates)
Merges two sorted Collections, a and b, into a single, sorted List
such that the ordering of the elements according to Comparator c is retained.
static <I,O,R extends Collection<? super O>>
R
collectIterable<? extends I> inputCollection,
Transformer<? super I,? extends O> transformer,
R outputCollection)
Transforms all elements from input collection with the given transformer
and adds them to the output collection.
static <I,O> Collection<O>
collectIterable<I> inputCollection,
Transformer<? super I,? extends O> transformer)
Returns a new Collection containing all elements of the input collection
transformed by the given transformer.
static <I,O,R extends Collection<? super O>>
R
collectIterator<? extends I> inputIterator,
Transformer<? super I,? extends O> transformer,
R outputCollection)
Transforms all elements from the input iterator with the given transformer
and adds them to the output collection.
static <I,O> Collection<O>
collectIterator<I> inputIterator,
Transformer<? super I,? extends O> transformer)
Transforms all elements from the input iterator with the given transformer
and adds them to the output collection.
static boolean
containsAllCollection<?> coll1,
Collection<?> coll2)
Returns true
iff all elements of coll2
are also contained
in coll1
.
static boolean
containsAnyCollection<?> coll1,
Collection<?> coll2)
Returns true
iff at least one element is in both collections.
static <T> boolean
containsAnyCollection<?> coll1,
T... coll2)
Returns true
iff at least one element is in both collections.
static <C> int
countMatchesIterable<C> input,
Predicate<? super C> predicate)
Deprecated.
static <O> Collection<O>
disjunctionIterable<? extends O> a,
Iterable<? extends O> b)
Returns a Collection
containing the exclusive disjunction (symmetric difference) of the given Iterable
s.
static <T> Collection<T>
emptyCollection
Returns the immutable EMPTY_COLLECTION with generic type safety.
static <T> Collection<T>
emptyIfNullCollection<T> collection)
Returns an immutable empty collection if the argument is null
,
or the argument itself otherwise.
static <C> boolean
existsIterable<C> input,
Predicate<? super C> predicate)
Deprecated.
static <E> E
extractSingletonCollection<E> collection)
Extract the lone element of the specified Collection.
static <T> boolean
filterIterable<T> collection,
Predicate<? super T> predicate)
Filter the collection by applying a Predicate to each element.
static <T> boolean
filterInverseIterable<T> collection,
Predicate<? super T> predicate)
Filter the collection by applying a Predicate to each element.
static <T> T
findIterable<T> collection,
Predicate<? super T> predicate)
Deprecated.
static <T,C extends Closure<? super T>>
T
forAllButLastDoIterable<T> collection,
C closure)
Deprecated.
static <T,C extends Closure<? super T>>
T
forAllButLastDoIterator<T> iterator,
C closure)
Deprecated.
static <T,C extends Closure<? super T>>
C
forAllDoIterable<T> collection,
C closure)
Deprecated.
static <T,C extends Closure<? super T>>
C
forAllDoIterator<T> iterator,
C closure)
Deprecated.
static <T> T
getIterable<T> iterable,
int index)
Deprecated.
static <T> T
getIterator<T> iterator,
int index)
Deprecated.
static <K,V> Map.Entry<K,V>
getMap<K,V> map,
int index)
Returns the index
-th Map.Entry
in the map
‘s entrySet
,
throwing IndexOutOfBoundsException
if there is no such element.
static Object
getObject object,
int index)
Returns the index
-th value in object
, throwing
IndexOutOfBoundsException
if there is no such element or
IllegalArgumentException
if object
is not an
instance of one of the supported types.
static <O> Map<O,Integer>
getCardinalityMapIterable<? extends O> coll)
Returns a Map
mapping each unique element in the given Collection
to an Integer
representing the number of occurrences of that element in the Collection
static <O> Collection<O>
intersectionIterable<? extends O> a,
Iterable<? extends O> b)
Returns a Collection
containing the intersection of the given Iterable
s.
static boolean
isEmptyCollection<?> coll)
Null-safe check if the specified collection is empty.
static boolean
isEqualCollectionCollection<?> a,
Collection<?> b)
true
iff the given
Returnsiff the given Collection
s contain exactly the same elements with exactly the same cardinalities.
static <E> boolean
isEqualCollectionCollection<? extends E> a,
Collection<? extends E> b,
Equator<? super E> equator)
true
iff the given
Returnsiff the given Collection
s contain exactly the same elements with exactly the same cardinalities.
static boolean
isFullCollection<? extends Object> coll)
Returns true if no more elements can be added to the Collection.
static boolean
isNotEmptyCollection<?> coll)
Null-safe check if the specified collection is not empty.
static boolean
isProperSubCollectionCollection<?> a,
Collection<?> b)
Returns true
iff a is a proper sub-collection of b,
that is, iff the cardinality of e in a is less
than or equal to the cardinality of e in b,
for each element e in a, and there is at least one
element f such that the cardinality of f in b
is strictly greater than the cardinality of f in a.
static boolean
isSubCollectionCollection<?> a,
Collection<?> b)
Returns true
iff a is a sub-collection of b,
that is, iff the cardinality of e in a is less than or
equal to the cardinality of e in b, for each element e
in a.
static <C> boolean
matchesAllIterable<C> input,
Predicate<? super C> predicate)
Deprecated.
static int
maxSizeCollection<? extends Object> coll)
Get the maximum number of elements that the Collection can contain.
static <E> Collection<List<E>>
permutationsCollection<E> collection)
Returns a Collection
of all the permutations of the input collection.
static <C> Collection<C>
predicatedCollectionCollection<C> collection,
Predicate<? super C> predicate)
Returns a predicated (validating) collection backed by the given collection.
static <E> Collection<E>
removeAllCollection<E> collection,
Collection<?> remove)
Removes the elements in remove
from collection
.
static <E> Collection<E>
removeAllIterable<E> collection,
Iterable<? extends E> remove,
Equator<? super E> equator)
Removes all elements in remove
from collection
.
static <C> Collection<C>
retainAllCollection<C> collection,
Collection<?> retain)
Returns a collection containing all the elements in collection
that are also in retain
.
static <E> Collection<E>
retainAllIterable<E> collection,
Iterable<? extends E> retain,
Equator<? super E> equator)
Returns a collection containing all the elements in
collection
that are also in retain
.
static void
reverseArrayObject[] array)
Reverses the order of the given array.
static <O> Collection<O>
selectIterable<? extends O> inputCollection,
Predicate<? super O> predicate)
Selects all elements from input collection which match the given
predicate into an output collection.
static <O,R extends Collection<? super O>>
R
selectIterable<? extends O> inputCollection,
Predicate<? super O> predicate,
R outputCollection)
Selects all elements from input collection which match the given
predicate and adds them to outputCollection.
static <O,R extends Collection<? super O>>
R
selectIterable<? extends O> inputCollection,
Predicate<? super O> predicate,
R outputCollection,
R rejectedCollection)
Selects all elements from inputCollection into an output and rejected collection,
based on the evaluation of the given predicate.
static <O> Collection<O>
selectRejectedIterable<? extends O> inputCollection,
Predicate<? super O> predicate)
Selects all elements from inputCollection which don’t match the given
predicate into an output collection.
static <O,R extends Collection<? super O>>
R
selectRejectedIterable<? extends O> inputCollection,
Predicate<? super O> predicate,
R outputCollection)
Selects all elements from inputCollection which don’t match the given
predicate and adds them to outputCollection.
static int
sizeObject object)
Gets the size of the collection/iterator specified.
static boolean
sizeIsEmptyObject object)
Checks if the specified collection/array/iterator is empty.
static <O> Collection<O>
subtractIterable<? extends O> a,
Iterable<? extends O> b)
<i>a</i> - <i>b</i>
.
Returns a new Collection
containing
static <O> Collection<O>
subtractIterable<? extends O> a,
Iterable<? extends O> b,
Predicate<O> p)
a minus a subset of
b.
Returns a new Collection
containingminus a subset of
static <C> Collection<C>
synchronizedCollectionCollection<C> collection)
Deprecated.
static <C> void
transformCollection<C> collection,
Transformer<? super C,? extends C> transformer)
Transform the collection by applying a Transformer to each element.
static <E> Collection<E>
transformingCollectionCollection<E> collection,
Transformer<? super E,? extends E> transformer)
Returns a transformed bag backed by the given collection.
static <O> Collection<O>
unionIterable<? extends O> a,
Iterable<? extends O> b)
Returns a Collection
containing the union of the given Iterable
s.
static <C> Collection<C>
unmodifiableCollectionCollection<? extends C> collection)
Deprecated.