Here you can find the source of size(Collection collection)
Parameter | Description |
---|---|
collection | Collection to compute size for. |
public static int size(Collection collection)
//package com.java2s; //License from project: Open Source License import java.util.Collection; public class Main { /**//from ww w . j a va 2 s . co m * Null-safe operation to determine the size of a collection. * * @param collection Collection to compute size for. * @return Returns 0 if the collection is null, otherwise the number of elements in the collection. */ public static int size(Collection collection) { return collection == null ? 0 : collection.size(); } }