Java Collection Min min(Collection doubles)

Here you can find the source of min(Collection doubles)

Description

min

License

Open Source License

Declaration

public static double min(Collection<Double> doubles) 

Method Source Code


//package com.java2s;
/* /*from   w w w  . j  av a 2s.  c om*/
 * This file is part of Transitime.org
 * 
 * Transitime.org is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License (GPL) as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 *
 * Transitime.org 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.
 *
 * You should have received a copy of the GNU General Public License
 * along with Transitime.org .  If not, see <http://www.gnu.org/licenses/>.
 */

import java.util.Collection;

public class Main {
    public static double min(Collection<Double> doubles) {
        if (doubles.size() < 1)
            throw new IllegalArgumentException("No items in list");
        Double min = Double.MAX_VALUE;
        for (Double doubleVal : doubles) {
            if (doubleVal < min)
                min = doubleVal;
        }
        return min;
    }
}

Related

  1. min(Collection coll)
  2. min(Collection data)
  3. min(Collection values)
  4. min(Collection a)
  5. min(Collection list)
  6. min(Collection strs)