Here you can find the source of max(Iterable
public static Integer max(Iterable<Integer> nums)
//package com.java2s; //License from project: Open Source License public class Main { public static Integer max(Iterable<Integer> nums) { Integer result = null;/*from w w w . ja v a 2 s . c om*/ for (Integer num : nums) { if (result == null || num > result) { result = num; } } return result; } }