Here you can find the source of hasValue(Collection> collection)
Parameter | Description |
---|---|
collection | The collection to test |
public static boolean hasValue(Collection<?> collection)
//package com.java2s; //License from project: Open Source License import java.util.Collection; public class Main { /**/*from w w w . j av a2 s. c om*/ * Does the given string have a "meaningful" value? This means its non-null/empty. Additionally, all-whitespace * strings will return false as those are not "meaningful" values. * @param text The text to test * @return Does the text have a meaningful value? */ public static boolean hasValue(String text) { return (text != null) && text.trim().length() > 0; } /** * Is this a non-null collection w/ at least 1 item in it? * @param collection The collection to test * @return Is it a collection with data in it? */ public static boolean hasValue(Collection<?> collection) { return (collection != null) && collection.size() > 0; } }