Slide 4
Slide 4 text
Java 7 way
Java 8 way
List humans = ...
Collections.sort(humans, new Comparator() {
@Override
public int compare(Human h1, Human h2)
return h1.getName().compareTo(h2.getName());
}
}
List humans = ...
Collections.sort(humans, (Human h1, Human h2) > {
h1.getName().compareTo(h2.getName())
});