public class CollectionFunctionals
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
CollectionFunctionals.FirstElementFunction<T> |
static class |
CollectionFunctionals.SizeFunction |
Constructor and Description |
---|
CollectionFunctionals() |
Modifier and Type | Method and Description |
---|---|
static <T,TT extends java.lang.Iterable<T>> |
all(<any> attributeSatisfies)
Returns a predicate for a collection which is true if
all elements in the collection given to the predicate
which satisfies the predicate given here.
|
static <T,TT extends java.lang.Iterable<T>> |
any(<any> attributeSatisfies)
Returns a predicate for a collection which is true if
there is at least one element in the collection given to the predicate
which satisfies the predicate given here.
|
static <I,T extends java.util.Collection<I>> |
contains(I item) |
static <any> |
empty() |
static <any> |
emptyOrNull() |
static <any> |
equalsSet(java.lang.Iterable<?> target) |
static <any> |
equalsSetOf(java.lang.Object... target)
default guava Equals predicate will reflect order of target, and will fail when matching against a list;
this treats them both as sets
|
static <T> <any> |
firstElement() |
static <K> <any> |
keys() |
static <T,I extends java.lang.Iterable<T>> |
limit(int max) |
static <K> <any> |
mapEmptyOrNull() |
static <K> <any> |
mapNotEmpty() |
static <K> <any> |
mapSize() |
static <K> <any> |
mapSize(java.lang.Integer valueIfNull) |
static <K> <any> |
mapSizeEquals(int targetSize) |
static <any> |
notEmpty() |
static <T,TT extends java.lang.Iterable<T>> |
quorum(QuorumCheck quorumCheck,
<any> attributeSatisfies)
Returns a predicate for a collection which is true if
the number of elements in the collection satisfying the predicate given here
passes the
QuorumCheck given here. |
static <any> |
sizeEquals(int targetSize) |
static <any> |
sizeFunction() |
static <any> |
sizeFunction(java.lang.Integer valueIfInputNull) |
static <any> |
sizeSupplier(java.lang.Iterable<?> collection) |
public static <any> sizeSupplier(java.lang.Iterable<?> collection)
public static <any> sizeFunction()
public static <any> sizeFunction(java.lang.Integer valueIfInputNull)
public static <T> <any> firstElement()
public static <K> <any> keys()
public static <K> <any> mapSize()
public static <K> <any> mapSize(java.lang.Integer valueIfNull)
public static <any> equalsSetOf(java.lang.Object... target)
public static <any> equalsSet(java.lang.Iterable<?> target)
public static <any> sizeEquals(int targetSize)
public static <any> empty()
public static <any> emptyOrNull()
public static <any> notEmpty()
public static <K> <any> mapSizeEquals(int targetSize)
public static <K> <any> mapEmptyOrNull()
public static <K> <any> mapNotEmpty()
public static <T,I extends java.lang.Iterable<T>> <any> limit(int max)
public static <I,T extends java.util.Collection<I>> <any> contains(I item)
public static <T,TT extends java.lang.Iterable<T>> <any> all(<any> attributeSatisfies)
This will return true for the empty set.
To require additionally that there is at least one
use #quorum(QuorumCheck, Predicate)
with
QuorumCheck.QuorumChecks.allAndAtLeastOne()
.
public static <T,TT extends java.lang.Iterable<T>> <any> any(<any> attributeSatisfies)
public static <T,TT extends java.lang.Iterable<T>> <any> quorum(QuorumCheck quorumCheck, <any> attributeSatisfies)
QuorumCheck
given here.