public class AlphanumericComparator extends Object implements Comparator<CharSequence>
| Constructor and Description |
|---|
AlphanumericComparator()
Creates a comparator that will use lexicographical sorting of the non-numerical parts of the compared strings.
|
AlphanumericComparator(Collator collator)
Creates a comparator that will use the given collator to sort the non-numerical parts of the compared strings.
|
AlphanumericComparator(Locale locale)
Creates a comparator that will use locale-sensitive sorting of the non-numerical parts of the compared strings.
|
| Modifier and Type | Method and Description |
|---|---|
private int |
compare(CharBuffer b1,
CharBuffer b2) |
int |
compare(CharSequence s1,
CharSequence s2) |
private int |
compareAsStrings(CharBuffer b1,
CharBuffer b2) |
private int |
compareNumerically(CharBuffer b1,
CharBuffer b2) |
private boolean |
isDigit(char c) |
private boolean |
isNumerical(CharBuffer buffer) |
private boolean |
isZero(char c) |
private void |
moveWindow(CharBuffer buffer) |
private void |
prepareForNextIteration(CharBuffer buffer) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcomparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLongprivate final Collator collator
public AlphanumericComparator()
public AlphanumericComparator(Locale locale)
locale - the locale to usepublic AlphanumericComparator(Collator collator)
collator - the collator to usepublic int compare(CharSequence s1, CharSequence s2)
compare in interface Comparator<CharSequence>private void moveWindow(CharBuffer buffer)
private int compare(CharBuffer b1, CharBuffer b2)
private boolean isNumerical(CharBuffer buffer)
private boolean isDigit(char c)
private int compareNumerically(CharBuffer b1, CharBuffer b2)
private void prepareForNextIteration(CharBuffer buffer)
private int compareAsStrings(CharBuffer b1, CharBuffer b2)
private boolean isZero(char c)
Copyright © 2011–2018 David R. Smith. All rights reserved.