Java - Data structure - Comparable/Comparator

 Comparable

The class need to implement the comparable first , and need to @Override the compareTo method in the object class


Comparator

Defind a comparator class that implmentent the comparator interface, then override the method , put the class as a object to the sort method , but remember to new the compatator object.

留言

此網誌的熱門文章

MAP - Sort with stream

JAVA - DSF Example