Java Collection Size size(Collection c)

Here you can find the source of size(Collection c)

Description

Returns 0 if the specified collection is null or the collection size if not null.

License

Open Source License

Parameter

Parameter Description
c the collection to size

Return

the size of the collection

Declaration

public static int size(Collection c) 

Method Source Code


//package com.java2s;

import java.util.Collection;

public class Main {
    /**//from   w  w  w .ja  v  a2 s .  c  o m
     * Returns 0 if the specified collection is null or the collection size
     * if not null.
     *
     * @param c the collection to size
     * @return the size of the collection
     */
    public static int size(Collection c) {
        return (c == null) ? 0 : c.size();
    }
}

Related

  1. size(Collection c)
  2. size(Collection collection)
  3. size(Collection collection)
  4. size(Collection... collections)