Javolution 6.0.0 java
javolution.util.function.Reducers Class Reference

Classes

class  AndReducer
 
class  AnyReducer
 
class  MaxReducer
 
class  MinReducer
 
class  OrReducer
 
class  SumReducer
 

Static Public Member Functions

static< E > Reducer< E > any (Class<? extends E > type)
 
static< E > Reducer< E > max (Comparator<? super E > comparator)
 
static< E > Reducer< E > min (Comparator<? super E > comparator)
 
static Reducer< Boolean > and ()
 
static Reducer< Boolean > or ()
 
static Reducer< Integer > sum ()
 

Private Member Functions

 Reducers ()
 

Detailed Description

A set of useful reducers of collection elements.

Author
Jean-Marie Dautelle
Version
6.0, July 21, 2013
See also
FastCollection::reduce(Reducer)

Definition at line 30 of file Reducers.java.

Constructor & Destructor Documentation

◆ Reducers()

javolution.util.function.Reducers.Reducers ( )
private

Definition at line 33 of file Reducers.java.

33 {}

Member Function Documentation

◆ and()

static Reducer<Boolean> javolution.util.function.Reducers.and ( )
static

Conditional 'and' operator (returns

true

if the collection is empty). This operator stops iterating as soon as a

false

value is found.

Definition at line 155 of file Reducers.java.

155  {
156  return new AndReducer();
157  }

◆ any()

static <E> Reducer<E> javolution.util.function.Reducers.any ( Class<? extends E >  type)
static

Returns any non-null element of the specified type. This reducer stops iterating as soon as an element with the matching type is found.

Definition at line 42 of file Reducers.java.

42  {
43  return new AnyReducer<E>(type);
44  }

Referenced by javolution.util.FastCollection< E >.any().

Here is the caller graph for this function:

◆ max()

static <E> Reducer<E> javolution.util.function.Reducers.max ( Comparator<? super E >  comparator)
static

Returns the greatest element of a collection according to the specified comparator (returns

null

if the collection is empty).

Parameters
comparatorthe comparator to use for comparison.

Definition at line 80 of file Reducers.java.

80  {
81  return new MaxReducer<E>(comparator);
82  }

Referenced by javolution.util.FastCollection< E >.max().

Here is the caller graph for this function:

◆ min()

static <E> Reducer<E> javolution.util.function.Reducers.min ( Comparator<? super E >  comparator)
static

Returns the smallest element of a collection according to the collection comparator (returns

null

if the collection is empty).

Definition at line 117 of file Reducers.java.

117  {
118  return new MinReducer<E>(comparator);
119  }

Referenced by javolution.util.FastCollection< E >.min().

Here is the caller graph for this function:

◆ or()

static Reducer<Boolean> javolution.util.function.Reducers.or ( )
static

Conditional 'or' operator (returns

false

if the collection is empty). This operator stops iterating as soon as a

true

value is found.

Definition at line 183 of file Reducers.java.

183  {
184  return new OrReducer();
185  }

◆ sum()

static Reducer<Integer> javolution.util.function.Reducers.sum ( )
static

Returns the sum of the specified integers value (returns

0


if the collection is empty).

Definition at line 210 of file Reducers.java.

210  {
211  return new SumReducer();
212  }

The documentation for this class was generated from the following file: