Here you can find the source of hasElements(Collection
Parameter | Description |
---|---|
T | the generic type |
collection | the collection |
public static <T> boolean hasElements(Collection<T> collection)
//package com.java2s; //License from project: Apache License import java.util.Collection; import java.util.Map; public class Main { /**//ww w .ja va2 s. com * Checks whether the COLLECTION is not NULL and has at least one element. * * @param <T> * the generic type * @param collection * the collection * @return true, if successful */ public static <T> boolean hasElements(Collection<T> collection) { return (null != collection && collection.size() > 0); } /** * Checks whether the MAP is not NULL and has at least one element. * * @param <T> * the generic type * @param <V> * the value type * @param map * the map * @return true, if successful */ public static <T, V> boolean hasElements(Map<T, V> map) { return (null != map && map.size() > 0); } }