I want to know how to compare the all array list element in the array list? Eg I want to compare element which is the largest number. Like comparing 1st element and 2nd element, 2nd element compares to the 3rd element. How to do it?
List <Product> productList= new ArrayList<>();
Can anyone give some example on how to compare with this variable?
productList.get(i).getPrice()
Thanks for help.
forloop, and store the largest