Here you can find the source of max(List
Parameter | Description |
---|---|
numbers | the numbers to calculate the max. |
public static BigDecimal max(List<BigDecimal> numbers)
//package com.java2s; //License from project: Open Source License import java.math.BigDecimal; import java.util.List; import java.util.TreeSet; public class Main { /**/*from w w w .j ava2 s .c o m*/ * Returns the max number in the numbers list. * * @param numbers the numbers to calculate the max. * @return the max number in the numbers list. */ public static BigDecimal max(List<BigDecimal> numbers) { return new TreeSet<BigDecimal>(numbers).last(); } }