Java Collection Max max(Collection doubles)

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

Description

max

License

Open Source License

Declaration

public static double max(Collection<Double> doubles) 

Method Source Code


//package com.java2s;
/* /* w w w. jav a2s  .c  o m*/
 * 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 max(Collection<Double> doubles) {
        if (doubles.size() < 1)
            throw new IllegalArgumentException("No items in list");
        Double max = 0d;
        for (Double doubleVal : doubles) {
            if (doubleVal > max)
                max = doubleVal;
        }
        return max;
    }
}

Related

  1. calculateMaxTime(Collection times)
  2. format(String theLabel, Collection coll, int maxNumberReported, String theClassName)
  3. getMaximumElementLength(final Collection collection)
  4. max(Collection coll)
  5. max(Collection data)
  6. max(Collection values)
  7. max(Collection collection)
  8. max(Collection list)
  9. max(Collection strs)