Javolution 6.0.0 java
javolution.util.function.Reducers.MaxReducer< E > Class Template Reference
Inheritance diagram for javolution.util.function.Reducers.MaxReducer< E >:
[legend]
Collaboration diagram for javolution.util.function.Reducers.MaxReducer< E >:
[legend]

Public Member Functions

 MaxReducer (Comparator<? super E > cmp)
 
void accept (Collection< E > param)
 
get ()
 
void accept (T param)
 

Private Attributes

final Comparator<? super E > cmp
 
final AtomicReference< E > max = new AtomicReference<E>(null)
 

Detailed Description

Definition at line 84 of file Reducers.java.

Constructor & Destructor Documentation

◆ MaxReducer()

javolution.util.function.Reducers.MaxReducer< E >.MaxReducer ( Comparator<? super E >  cmp)

Definition at line 88 of file Reducers.java.

88  {
89  this.cmp = cmp;
90  }

References javolution.util.function.Reducers.MaxReducer< E >.cmp.

Member Function Documentation

◆ accept() [1/2]

void javolution.util.function.Reducers.MaxReducer< E >.accept ( Collection< E >  param)

Definition at line 93 of file Reducers.java.

93  {
94  Iterator<E> it = param.iterator();
95  while (it.hasNext()) {
96  E e = it.next();
97  E read = max.get();
98  while ((read == null) || (cmp.compare(e, read) > 0)) {
99  if (max.compareAndSet(read, e)) break;
100  read = max.get();
101  }
102  }
103  }

References javolution.util.function.Reducers.MaxReducer< E >.cmp, and javolution.util.function.Reducers.MaxReducer< E >.max.

◆ accept() [2/2]

void javolution.util.function.Consumer< T >.accept ( param)
inherited

Accepts an input value.

◆ get()

Definition at line 106 of file Reducers.java.

106  {
107  return max.get();
108  }

References javolution.util.function.Reducers.MaxReducer< E >.max.

Member Data Documentation

◆ cmp

◆ max

final AtomicReference<E> javolution.util.function.Reducers.MaxReducer< E >.max = new AtomicReference<E>(null)
private

The documentation for this class was generated from the following file:
javolution.util.function.Reducers.MaxReducer.cmp
final Comparator<? super E > cmp
Definition: Reducers.java:85
javolution.util.function.Reducers.MaxReducer.max
final AtomicReference< E > max
Definition: Reducers.java:86