As we know, ArrayList in Java is used to hold any type of data in an array. ArrayList can be sorted easily using the sort() that is defined in the Collections class. Since the method is static, we can call the sort method as follows:
Collections.sort();
For e.g.
ArrayList<String> arr=new ArrayList<String>;
Collections.sort(arr);
Collections.sort();
For e.g.
ArrayList<String> arr=new ArrayList<String>;
Collections.sort(arr);
No comments:
Post a Comment