public static class Navigable.NavigableComparator
extends java.lang.Object
implements java.util.Comparator
Comparator
implementation used for sorting child Navigable
instances by label. This Comparator
has a
provision for optionally specifying one item that is to appear first
in the sorting order, regardless of its sorting position
lexicographically.Modifier and Type | Field and Description |
---|---|
protected static java.text.Collator |
COLLATOR |
Constructor and Description |
---|
Navigable.NavigableComparator()
Constructs a default
NavigableComparator . |
Navigable.NavigableComparator(java.lang.String firstItemLabel)
Constructs a
NavigableComparator using the specified
label for the Navigable that is to appear first in the
sorting order. |
Modifier and Type | Method and Description |
---|---|
int |
compare(java.lang.Object o1,
java.lang.Object o2) |
java.lang.String |
getFirstItemLabel()
Returns the label of the item that should appear first in the
sorting order; returns
null if all Navigable
instances are sorted lexicographically. |
void |
setFirstItemLabel(java.lang.String firstItemLabel)
Sets the label of the item that is to appear first in the sorting
order; if
null , then all Navigable instances
are sorted lexicographically. |
public Navigable.NavigableComparator()
NavigableComparator
.public Navigable.NavigableComparator(java.lang.String firstItemLabel)
NavigableComparator
using the specified
label for the Navigable
that is to appear first in the
sorting order.public void setFirstItemLabel(java.lang.String firstItemLabel)
null
, then all Navigable
instances
are sorted lexicographically.public java.lang.String getFirstItemLabel()
null
if all Navigable
instances are sorted lexicographically.public int compare(java.lang.Object o1, java.lang.Object o2)
compare
in interface java.util.Comparator