Here you can find the source of size(Collection> collection)
public static int size(Collection<?> collection)
//package com.java2s; import java.util.Collection; public class Main { /**/*w w w .j av a 2 s . c om*/ * Get the size of specified collection. */ public static int size(Collection<?> collection) { if (collection == null) { return 0; } return collection.size(); } }