Package com.opencsv.bean.comparator
Class LiteralComparator<T extends Comparable<T>>
java.lang.Object
com.opencsv.bean.comparator.LiteralComparator<T>
- Type Parameters:
T
- The type to be sorted
- All Implemented Interfaces:
Serializable
,Comparator<T>
@Deprecated
public class LiteralComparator<T extends Comparable<T>>
extends Object
implements Comparator<T>, Serializable
Deprecated.
This
Comparator
takes an array of literals that define an
order.
Anything not included in the array is placed after anything in the array and
is then sorted according to its natural order.- Since:
- 4.3
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Comparator
<T> Deprecated.private static final long
Deprecated. -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDDeprecated.- See Also:
-
c
Deprecated.
-
-
Constructor Details
-
LiteralComparator
Deprecated.Constructor.- Parameters:
predefinedOrder
- Objects that define the order of comparison
-
-
Method Details
-
compare
Deprecated.- Specified by:
compare
in interfaceComparator<T extends Comparable<T>>
-
List<T> predefinedList = Arrays.<T>asList(predefinedOrder); FixedOrderComparator<T> fixedComparator = new FixedOrderComparator<>(predefinedList); fixedComparator.setUnknownObjectBehavior(FixedOrderComparator.UnknownObjectBehavior.AFTER); Comparator<T> c = new ComparatorChain<>(Arrays.<Comparator<T>>asList( fixedComparator, new NullComparator<>(false), new ComparableComparator<>()));