Bug 572426 - [AutoRefactor immigration #67/151] [cleanup & saveaction]
Implicit comparator

Removes the comparator declaration if it is the default one:
 - The declared comparator should be an equivalent to the natural order,
 - Remove anonymous class, lambda, Comparator.comparing(),
Comparator.naturalOrder() and null,
 - Apply on List.sort(Comparator), Collections.sort(List, Comparator),
Collections.max(Collection, Comparator) and Collections.min(Collection,
Comparator),
 - If the comparator is used in the method List.sort(Comparator), the
method is converted into Collections.sort(List).

Given:
Collections.sort(listToSort, new Comparator<Date>() {
    @Override
    public int compare(Date o1, Date o2) {
        return o1.compareTo(o2);
    }
});

When:
Clean up the code enabling "Use implicit comparator when possible"

Then:
Collections.sort(listToSort);

Change-Id: I60f143b299a21445822a4b93d79878969a4b13ed
Signed-off-by: Fabrice Tiercelin <fabrice.tiercelin@yahoo.fr>
Depends-On: Ic98952f83de7fede5214b18ecad639f901abd43e
4 files changed