Jeef Jeef - 1 year ago 150
Java Question

Sorting ArrayList with Lambda in Java 8

Could somebody show me a quick example how to sort an ArrayList alphabetically in Java 8 using the new Lambda Syntax.

Answer Source

For strings this would work

arrayList.sort((p1, p2) -> p1.compareTo(p2));
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download