Java tutorial
//package com.java2s; /* * Copyright (c) 2011-Present. Codeprimate, LLC and authors. All Rights Reserved. * * This software is licensed under the Codeprimate End User License Agreement (EULA). * This software is proprietary and confidential in addition to an intellectual asset * of the aforementioned authors. * * By using the software, the end-user implicitly consents to and agrees to be in compliance * with all terms and conditions of the EULA. Failure to comply with the EULA will result in * the maximum penalties permissible by law. * * In short, this software may not be reverse engineered, reproduced, copied, modified * or distributed without prior authorization of the aforementioned authors, permissible * and expressed only in writing. The authors grant the end-user non-exclusive, non-negotiable * and non-transferable use of the software "as is" without expressed or implied WARRANTIES, * EXTENSIONS or CONDITIONS of any kind. * * For further information on the software license, the end user is encouraged to read * the EULA @ ... */ import java.util.Collection; public class Main { /** * Determines the size of the specified Collection. If the Collection is null or contains no elements, then the * size of the Collection is 0, otherwise the size of the Collection is determined by it's size() method. * * @param collection the Collection who's size is being determined. * @return an integer value specifying the size of the Collection. * @see java.util.Collection#size() */ public static int size(final Collection collection) { return (collection == null ? 0 : collection.size()); } }