java sorted list

Sort ArrayList with Collections sort()

Collections algorithms makes a programmer's work easier and avoids lots of simple, but extra code. It is proved in each method of Collections class. The sorting algorithm places the elements in ascending order, known as natural order (a before b and 1 before 2). Internally, the data structure elements are converted into an array and …

Sort ArrayList with Collections sort() Read More »

List Reverse Sort Java

Note: It is advised to read List Fundamentals before proceeding the following programs. Four programs are given on List with different functionalities. List Methods: Uses frequently used methods like size(), add(), get(), contains(), indexOf(), lastIndexOf(), subList(), remove(), clear() and isEmpty(). List Iteration: Comparing two lists with equals(), converting list elements to array with toArray(), printing …

List Reverse Sort Java Read More »