Class NaturalOrderComparator
- java.lang.Object
-
- com.github.guillaumederval.javagrading.utils.NaturalOrderComparator
-
- All Implemented Interfaces:
Comparator
public class NaturalOrderComparator extends Object implements Comparator
This is an updated version with enhancements made by Daniel Migowski, Andre Bogus, and David Koelle. Updated by David Koelle in 2017. To use this class: Use the static "sort" method from the java.util.Collections class: Collections.sort(your list, new AlphanumComparator());
-
-
Constructor Summary
Constructors Constructor Description NaturalOrderComparator()
-
Method Summary
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
-
-
-
Method Detail
-
compare
public int compare(Object s1o, Object s2o)
- Specified by:
comparein interfaceComparator
-
main
public static void main(String[] args)
Shows an example of how the comparator works. Feel free to delete this in your own code!
-
-