Here you can find the source of findMax(Iterable
public static <T extends Comparable<T>> T findMax(Iterable<T> collection)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { public static <T extends Comparable<T>> T findMax(Iterable<T> collection) { T max = null;//from www.j ava 2 s . c om Iterator<T> it = collection.iterator(); while (it.hasNext()) { T obj = it.next(); if (null == max || max.compareTo(obj) < 0) { max = obj; } } return max; } }