public enum SortDir extends Enum<SortDir>
Enum Constant and Description |
---|
ASC
Ascending sort order.
|
DESC
Descending sort order.
|
Modifier and Type | Method and Description |
---|---|
abstract <X> Comparator<X> |
comparator(Comparator<X> c)
An example of how to use this:
|
static SortDir |
toggle(SortDir sortDir)
Toggles the given sort direction, that is given one sort direction, it
returns the other.
|
static SortDir |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static SortDir[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final SortDir ASC
public static final SortDir DESC
public static SortDir[] values()
for (SortDir c : SortDir.values()) System.out.println(c);
public static SortDir valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic static SortDir toggle(SortDir sortDir)
sortDir
- the sort direction to togglepublic abstract <X> Comparator<X> comparator(Comparator<X> c)
List<Something> list = ...
Collections.sort(list, SortDir.ASC.comparator(new Comparator() { public int
compare(Object o1, Object o2) { return ... } });
X
- the type sorted by the comparitorc
- the comparator to be wrappedCopyright © 2020. All rights reserved.