Lovely Java Improvements – Thanks @JetBrains #IntelliJ

Back in the day, this is how I would sort an array of file names in alphabetical order:

secondaryTaskConfigFiles.sort(new Comparator() {
public int compare(File o1, File o2) {
return o1.getName().compareTo(o2.getName());

So IntelliJ told me to change the code to a lambda expression:

secondaryTaskConfigFiles.sort((o1, o2) -> o1.getName().compareTo(o2.getName()));

Looks nice? Yep! …But wait… another suggestion:


Thanks JetBrains for a fantastic IDE. For programmers used to the “old” ways it helps a lot!