package com.usr.collections;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class FindMaxAndMinValueOfArrayList {
public static void main(String[] args) {
List<Integer> list = new ArrayList<Integer>();
list.add(new Integer("12676"));
list.add(new Integer("576767"));
list.add(new Integer("8778978"));
list.add(new Integer("3432432"));
Object maxValue = Collections.max(list);
System.out.println("max value of list" + maxValue);
Object minValue = Collections.min(list);
System.out.println("min value of list:" + minValue);
}
}
No comments:
Post a Comment
Note: only a member of this blog may post a comment.