Java examples for java.util:TreeSet
Returns the max number in the numbers list using TreeSet.
//package com.java2s; import java.math.BigDecimal; import java.util.List; import java.util.TreeSet; public class Main { /**/* w ww . j a va2 s . c om*/ * 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(); } }