People talking about Comparators and Comparables. To do that we have to arrange stuff in specific manner.
Java ArrayList (ArrayList (Java 2 Platform SE 5.0)) class is a fastest and easiest way to represent one-dimensional array. ArrayList not synchronized, that is cross thread access may cause problems. It holds an ordered item sequence of items (objects) like an array, but there are differences: Size of an ArrayList could change dynamically, by adding or removing elementsAn ArrayList can hold only object references, not primitives