I am learning Java and while trying to sort an ArrayList of objects I found this way of doing it.
ArrayList<String> al = new ArrayList<String>(); al.add("Friends"); al.add("Dear"); al.add("Is"); al.add("Superb"); Collections.sort(al); System.out.println("List after the use of" + " Collection.sort() :\n" + al); This method works but since I come from a functional programming background I was wondering what are the most elegant ways to do sorting on a collection in Java in functional style (so by returning a new collection and not by modifying the original one).