Java Collection Min min(Collection data)

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

Description

min

License

Open Source License

Parameter

Parameter Description
data a parameter

Return

the min

Declaration

public static Double min(Collection<Double> data) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2009, 2013, 2014 Matthew Purver, Queen Mary University of London.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v3.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/gpl.html// w  w w . j  av a2 s .  co m
 ******************************************************************************/

import java.util.Collection;
import java.util.Collections;

public class Main {
    /**
     * @param data
     * @return the min
     */
    public static Double min(Collection<Double> data) {
        return Collections.min(data);
    }

    /**
     * @param data
     * @return the min
     */
    public static double min(double[] data) {
        double min = Double.POSITIVE_INFINITY;
        for (double datum : data) {
            min = Math.min(min, datum);
        }
        return min;
    }
}

Related

  1. min(Collection coll)
  2. min(Collection doubles)
  3. min(Collection values)
  4. min(Collection a)
  5. min(Collection list)