Java List Max getMax(List d)

Here you can find the source of getMax(List d)

Description

Returns the maximum value of an Arraylist with doubles

License

Open Source License

Parameter

Parameter Description
d array list

Return

maxima

Declaration

public static double getMax(List<Double> d) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.List;

public class Main {
    /**/* w  w w .  ja  v  a2  s .co  m*/
     * Returns the maximum value of an Arraylist with doubles
     * 
     * @param d
     *            array list
     * @return maxima
     */
    public static double getMax(List<Double> d) {
        double res = -Double.MAX_VALUE;
        for (Double db : d) {
            if (db > res)
                res = db;
        }
        return res;
    }

    /**
     * Returns the maximum value of an Arraylist with doubles
     * 
     * @param d
     *            array list
     * @return maxima
     */
    public static double getMax(double[] d) {
        double res = -Double.MAX_VALUE;
        for (Double db : d) {
            if (db > res)
                res = db;
        }
        return res;
    }
}

Related

  1. findMax(List values)
  2. findMaxDeformationCount(final List counts)
  3. findMaximalMatch(List> mapList, LinkedHashMap fieldsByPriority)
  4. getMax(List numList)
  5. getMax(List aList)
  6. getMax(List list)
  7. getMax(List numbers)
  8. getMax(List list)
  9. getMaxColumnSizes(List resultSet)