Package org.apache.jorphan.util
Class AlphaNumericKeyComparator
-
- All Implemented Interfaces:
-
java.util.Comparator
public class AlphaNumericKeyComparator implements Comparator<T>
Comparator for Map.Entry Objects, that compares based on their keys only. The keys will be compared in a human readable fashion by trying to parse numbers that appear in the keys as integers and compare those, too.
Heavily influenced by https://codereview.stackexchange.com/questions/37192/number-aware-string-sorting-with-comparator
-
-
Field Summary
Fields Modifier and Type Field Description public final static AlphaNumericKeyComparatorINSTANCE
-
Method Summary
Modifier and Type Method Description intcompare(Map.Entry<Object, Object> o1, Map.Entry<Object, Object> o2)-
Methods inherited from class java.util.Comparator
comparing, comparingDouble, comparingInt, comparingLong, naturalOrder, nullsFirst, nullsLast, reverseOrder, reversed, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-