Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
2.4.5
-
None
-
None
Description
in numberAwareCompareTo()
NumberAwareComparator<Comparable> numberAwareComparator = new NumberAwareComparator<Comparable>(); return numberAwareComparator.compare(self, other);
The code inside NumberAwareComparator.compare can be static, so there is no need to create a new Instance of the Comparator every numberAwareCompareTo is called. I suggest extracting the logic into a public static method, and to use that, or anything similar.