Here you can find the source of count(Collection collection)
public static int count(Collection collection)
//package com.java2s; //License from project: Open Source License import java.util.Collection; import java.util.Map; public class Main { public static int count(Collection collection) { if (isEmpty(collection)) return 0; return collection.size(); }/*w w w .ja v a 2s. c o m*/ public static int count(Map collection) { if (isEmpty(collection)) return 0; return collection.size(); } public static boolean isEmpty(Collection collection) { if (null == collection) return true; return collection.isEmpty(); } public static boolean isEmpty(Map collection) { if (null == collection) return true; return collection.isEmpty(); } }