org.rightcollections.impl
Class MaxElementClosure<E>

java.lang.Object
  extended by org.rightcollections.impl.MaxElementClosure<E>
Type Parameters:
E - type of element
All Implemented Interfaces:
Closure<E>, Function<java.lang.Void,E>

public class MaxElementClosure<E>
extends java.lang.Object
implements Closure<E>

Calculates maximum.

Author:
Ruslan Pilin

Constructor Summary
MaxElementClosure(java.util.Comparator<E> comparator)
          Constructs closure using comparator.
 
Method Summary
 java.lang.Void apply(E argument)
          Applies this function on an argument.
 E getMax()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.rightcollections.Function
equals
 

Constructor Detail

MaxElementClosure

public MaxElementClosure(java.util.Comparator<E> comparator)
Constructs closure using comparator.

Parameters:
comparator - comparator to use
Method Detail

apply

public final java.lang.Void apply(E argument)
Description copied from interface: Function
Applies this function on an argument.

Specified by:
apply in interface Function<java.lang.Void,E>
Parameters:
argument - argument to test for max.
Returns:
null
See Also:
Function.apply(java.lang.Object)

getMax

public final E getMax()
Returns:
maximum element


Copyright © 2009 Ruslan Pilin. All Rights Reserved.