Get minimum value in Arraylist java

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
 
class MinValue {
    public static void main(String[] args)
    {
    	List<Integer> list = new ArrayList<>();
    	list.add(12);
    	list.add(10);
    	list.add(32);
    	list.add(42);
    	list.add(11);
    	list.add(44);
 
    	int minValue = (int) Collections.min(list);
    	int minIndex = list.indexOf(Collections.min(list));
 
        System.out.println("Minimum Value: " + minValue);
        System.out.println("Minimum Value Indx: " + minIndex);
    }
}

Output:

Minimum Value: 10
Minimum Value Indx: 1
Content Protection by DMCA.com
Please Share