weiss.util
Class Collections

java.lang.Object
  extended by weiss.util.Collections

public class Collections
extends java.lang.Object

Instanceless class contains static methods that operate on collections.


Method Summary
static
<AnyType extends java.lang.Object & java.lang.Comparable<? super AnyType>>
AnyType
max(Collection<? extends AnyType> coll)
          Returns the maximum object in the collection, using default ordering
static
<AnyType> AnyType
max(Collection<? extends AnyType> coll, Comparator<? super AnyType> cmp)
          Returns the maximum object in the collection, using comparator.
static
<AnyType> Comparator<AnyType>
reverseOrder()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

max

public static <AnyType extends java.lang.Object & java.lang.Comparable<? super AnyType>> AnyType max(Collection<? extends AnyType> coll)
Returns the maximum object in the collection, using default ordering

Parameters:
coll - the collection.
Returns:
the maximum object.
Throws:
NoSuchElementException - if coll is empty.
java.lang.ClassCastException - if objects in collection cannot be compared.

max

public static <AnyType> AnyType max(Collection<? extends AnyType> coll,
                                    Comparator<? super AnyType> cmp)
Returns the maximum object in the collection, using comparator.

Parameters:
coll - the collection.
cmp - the comparator.
Returns:
the maximum object.
Throws:
NoSuchElementException - if coll is empty.
java.lang.ClassCastException - if objects in collection cannot be compared.

reverseOrder

public static <AnyType> Comparator<AnyType> reverseOrder()