Java Collection Max max(Collection elems)

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

Description

max

License

Apache License

Declaration

public static <T extends Comparable<T>> T max(Collection<T> elems) 

Method Source Code


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

import java.util.*;

public class Main {
    public static <T extends Comparable<T>> T max(Collection<T> elems) {
        T max = null;//from ww  w  . j  a  v  a  2 s  . co  m
        for (T t : elems) {
            if (max == null || max.compareTo(t) < 0) {
                max = t;
            }
        }
        return max;
    }
}

Related

  1. max(Collection values)
  2. max(Collection collection)
  3. max(Collection list)
  4. max(Collection strs)
  5. max(Collection col)
  6. max(Collection values)
  7. max(Collection values)
  8. max(final Collection values)
  9. max(final Collection collection)