Java Array Max Value max(T first, T... others)

Here you can find the source of max(T first, T... others)

Description

max

License

Apache License

Declaration

@SafeVarargs
    public static <T extends Comparable<T>> T max(T first, T... others) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    @SafeVarargs
    public static <T extends Comparable<T>> T max(T first, T... others) {
        T result = first;/*from w  w  w.ja  v a 2  s  .  c o m*/

        for (T value : others) {
            if (value.compareTo(result) > 0) {
                result = value;
            }
        }

        return result;
    }
}

Related

  1. max(long[] array)
  2. max(long[] array)
  3. max(long[] array)
  4. max(Number... array)
  5. max(Number[] array)
  6. max(T... elems)
  7. max(T... values)
  8. max(T[] args)
  9. max_array(byte[] arr)