Java Collection Size sizeOf(Collection collection)

Here you can find the source of sizeOf(Collection collection)

Description

size Of

License

Apache License

Declaration

@SuppressWarnings("rawtypes")
    public static int sizeOf(Collection collection) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Collection;

import java.util.Map;

public class Main {
    @SuppressWarnings("rawtypes")
    public static int sizeOf(Collection collection) {
        if (isEmpty(collection)) {
            return 0;
        }/*from   w  w w.  j ava 2  s.co m*/
        return collection.size();
    }

    public static boolean isEmpty(Collection<?> collection) {
        return (collection == null || collection.isEmpty());
    }

    /**
     * Return <code>true</code> if the supplied Map is <code>null</code>
     * or empty. Otherwise, return <code>false</code>.
     * @param map the Map to check
     * @return whether the given Map is empty
     */
    public static boolean isEmpty(Map map) {
        return (map == null || map.isEmpty());
    }
}

Related

  1. size(Collection v)
  2. size(final Collection collection)
  3. size(final Collection collection)
  4. size(final Collection items)
  5. sizeM1(Collection collection)
  6. sizeOf(Collection collection)
  7. sizeOf(Collection coll)
  8. sizeOf(Collection collection)