Java Number Max Value max(final Iterable values)

Here you can find the source of max(final Iterable values)

Description

Retrieve the max element

License

Open Source License

Parameter

Parameter Description
values a parameter

Declaration

public static Double max(final Iterable<Double> values) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/*from  www  .  ja  va2  s  .  com*/
     * Calculates the max of an Array
     */
    public static double max(final double... array) {
        double max = Double.NEGATIVE_INFINITY;
        for (final double value : array) {
            if (max < value) {
                max = value;
            }
        }
        return max;
    }

    /**
     * Retrieve the max element
     *
     * @param values
     * @return
     */
    public static Double max(final Iterable<Double> values) {
        Double max = Double.NEGATIVE_INFINITY;
        for (final Double value : values) {
            if (max < value) {
                max = value;
            }
        }
        return max;
    }
}

Related

  1. max(final float a, final float b)
  2. max(final float a, final float b, final float c)
  3. max(final int a, final int b)
  4. max(final int a, final int b)
  5. max(final Iterable numbers)
  6. max(final NUMBER_TYPE n1, final NUMBER_TYPE n2)
  7. max(final NUMBER_TYPE number1, final NUMBER_TYPE number2)
  8. max(final String string1, final String string2)
  9. Max(float a, float b)