net.sf.jga.fn.algorithm
public class MaxValue<T> extends AbstractUnaryFunctor<Collection<? extends T>,T> implements Serializable
Copyright © 2003 David A. Hall
Nested Class Summary | |
---|---|
interface | MaxValue.Visitor
Interface for classes that may interpret an MaxValue functor. |
Constructor Summary | |
---|---|
MaxValue(Comparator<T> comp)
Builds a MaxValue functor that will use the given comparator to
compare elements in the collection. |
Method Summary | |
---|---|
void | accept(Visitor v)
Calls the Visitor's visit(MaxValue) method, if it
implements the nested Visitor interface. |
T | fn(Collection<? extends T> collection)
Returns the largest value in the collection |
Comparator<T> | getComparator()
Returns the comparator used to order values in the collection. |
String | toString() |
Throws: IllegalArgumentException if the Comparator is null
visit(MaxValue)
method, if it
implements the nested Visitor interface.Throws: NoSuchElementException if the collection is empty