Java List Max getMaxValue(List values)

Here you can find the source of getMaxValue(List values)

Description

get Max Value

License

Open Source License

Declaration

public static double getMaxValue(List<Double> values) 

Method Source Code

//package com.java2s;
/*/*from   w ww.  j ava 2s. c  o  m*/
 *    This program is free software; you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation; either version 2 of the License, or
 *    (at your option) any later version.
 *
 *    This program is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    Copyright (C) 2015 George Antony Papadakis (gpapadis@yahoo.gr)
 */

import java.util.List;

public class Main {
    public static double getMaxValue(List<Double> values) {
        if (values.isEmpty()) {
            return -1.0;
        }

        double max = -1.0;
        for (Double value : values) {
            if (max < value) {
                max = value;
            }
        }

        return max;
    }
}

Related

  1. getMaxOfAList(List list)
  2. getMaxSize(final List list)
  3. getMaxStrWidth(List list)
  4. getMaxValIndex(List vals)
  5. getMaxValue(List list)
  6. max(final List aList, final Double aDefalut)
  7. max(List values)
  8. max(List a, List b)
  9. max(List booleans)