public static void main(String[] args) { List list = new ArrayList(); list.add(1); list.add(9); list.add(3); list.add(5); list.add(4); System.out.println(list); System.out.println("最大值: " + Collections.max(list)); System.out.println("最小值: " + Collections.min(list)); List<Integer> lists = list; DoubleSummaryStatistics statistics = lists.stream().mapToDouble(Number::doubleValue).summaryStatistics(); System.out.println("最大值:" + statistics.getMax()); System.out.println("最小值:" + statistics.getMin()); System.out.println("平均值:" + statistics.getAverage()); System.out.println("平均值四舍五入:" + Math.round(statistics.getAverage())); System.out.println("求和:" + statistics.getSum()); System.out.println("计数:" + statistics.getCount()); }