Here you can find the source of size(Collection> coll)
public static int size(Collection<?> coll)
//package com.java2s; //License from project: Open Source License import java.util.Collection; public class Main { public static int size(Collection<?> coll) { if (isNull(coll)) { return 0; }//from w w w .j a va 2 s . c o m return coll.size(); } public static int size(Object[] arr) { if (isNull(arr)) { return 0; } return arr.length; } public static boolean isNull(Object obj) { return null == obj; } }