Check out example codes for "sort an arraylist of integer". It will help you in understanding the concepts better.

Code Example 1

//METHOD RETURNS VOID
Collections.sort(arrayList);

Code Example 2

import Collections

ArrayList< int > a = new ArrayList();
a.add(1);
a.add(3);
a.add(2);
a.add(-3);

ArrayList< int > sorted = Collections.sort(a);

Learn ReactJs, React Native from akashmittal.com