public class NaturalComparator<T> extends Object implements Comparator<T>
NaturalComparator allows to compare two elements in a human way,
which is commonly interpreted as a comparison which:
| Modifier and Type | Class and Description |
|---|---|
static interface |
NaturalComparator.Translator<T> |
| Constructor and Description |
|---|
NaturalComparator()
Instantiate a basic
NaturalComparator which compare the elements
based on their string representation (Object.toString()). |
NaturalComparator(NaturalComparator.Translator<T> translator)
Instantiate a
NaturalComparator which exploits a specific string
representation for the elements. |
public NaturalComparator()
NaturalComparator which compare the elements
based on their string representation (Object.toString()).public NaturalComparator(NaturalComparator.Translator<T> translator)
NaturalComparator which exploits a specific string
representation for the elements.public int compare(T s1, T s2)
compare in interface Comparator<T>Copyright © 2014–2015. All rights reserved.