public class Reducers extends Object
A set of useful reducers
of collection elements.
FastCollection.reduce(Reducer)
Modifier and Type | Method and Description |
---|---|
static Reducer<Boolean> |
and()
Conditional 'and' operator (returns
true if the collection is
empty). |
static <E> Reducer<E> |
any(Class<? extends E> type)
Returns any non-null element of the specified type.
|
static <E> Reducer<E> |
max(Comparator<? super E> comparator)
Returns the greatest element of a collection according to the
specified comparator (returns
null if the collection is empty). |
static <E> Reducer<E> |
min(Comparator<? super E> comparator)
Returns the smallest element of a collection according to the collection
comparator (returns
null if the collection is empty). |
static Reducer<Boolean> |
or()
Conditional 'or' operator (returns
false if the collection is
empty). |
static Reducer<Integer> |
sum()
Returns the sum of the specified integers value (returns
0
if the collection is empty). |
@Parallelizable @Realtime(limit=LINEAR) public static <E> Reducer<E> any(Class<? extends E> type)
@Parallelizable(mutexFree=true, comment="Internal use of AtomicReference") @Realtime(limit=LINEAR) public static <E> Reducer<E> max(Comparator<? super E> comparator)
null
if the collection is empty).comparator
- the comparator to use for comparison.@Parallelizable(mutexFree=true, comment="Internal use of AtomicReference") @Realtime(limit=LINEAR) public static <E> Reducer<E> min(Comparator<? super E> comparator)
null
if the collection is empty).@Parallelizable @Realtime(limit=LINEAR) public static Reducer<Boolean> and()
true
if the collection is
empty). This operator stops iterating as soon as a false
value
is found.@Parallelizable @Realtime(limit=LINEAR) public static Reducer<Boolean> or()
false
if the collection is
empty). This operator stops iterating as soon as a true
value
is found.Copyright © 2005-2013 Javolution. All Rights Reserved.