Java List Min getMinValue(List values)

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

Description

get Min Value

License

Open Source License

Declaration

public static double getMinValue(List<Double> values) 

Method Source Code

//package com.java2s;
/*/*from  www . j  av a2 s .  c  om*/
 *    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 getMinValue(List<Double> values) {
        if (values.isEmpty()) {
            return -1.0;
        }

        double min = Double.MAX_VALUE;
        for (Double value : values) {
            if (value < min) {
                min = value;
            }
        }

        return min;
    }
}

Related

  1. getMin(List aList)
  2. getMin(List d)
  3. getMin(List numbers)
  4. getMinId(List ids)
  5. getMinimums(List data)
  6. getMinWhitespace(final List lines)
  7. min(final List aList, final Double aDefalut)
  8. min(List values)
  9. min(List a, List b)