Package eu.simuline.util
Class Comparators<E>
- java.lang.Object
-
- eu.simuline.util.Comparators<E>
-
- Type Parameters:
E- the type to be compared. Created: Sat May 21 16:30:58 2005
public abstract class Comparators<E> extends Object
Collection of static methods related withComparators.- Version:
- 1.0
- Author:
- Ernst Reissner
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classComparators.AsListed<E>Implements an ordering given by the listComparators.AsListed.seq.private static classComparators.Cascade<E>Represents a comparator which is a cascade of comparators: Starting with the first comparator inComparators.Cascade.seqasks the next comparator if the current one detects equality.
-
Constructor Summary
Constructors Constructor Description Comparators()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <E> Comparator<E>getAsListed(List<E> seq)Returns an ordering given by the listComparators.AsListed.seq.static <E> Comparator<E>getCascade(Collection<Comparator<E>> seq)static <E> Comparator<E>getInv(Comparator<E> cmp)static <E> Comparator<E>getNegative(Comparator<E> cmp)
-
-
-
Method Detail
-
getNegative
public static <E> Comparator<E> getNegative(Comparator<E> cmp)
-
getInv
public static <E> Comparator<E> getInv(Comparator<E> cmp)
-
getCascade
public static <E> Comparator<E> getCascade(Collection<Comparator<E>> seq)
-
getAsListed
public static <E> Comparator<E> getAsListed(List<E> seq)
Returns an ordering given by the listComparators.AsListed.seq. Elements not in the list are all minimal and pairwise equal with respect to this comparator. They are less than all elements in the list. The ordering on the list is ascending.CAUTION: This ordering is consistent with equals only under certain conditions. The other ordering axioms hold. For more details see
Comparators.AsListed.Caution: changing the list, affects the comparator.
- Parameters:
seq- a list which determines the ordering.- Throws:
NullPointerException- ifseqisnull.
-
-