luni, 29 iunie 2015

[OmniFaces utilities 2.0] Check if at least one value is empty


[OmniFaces utilities] The isAnyEmpty() method returns true if at least one value is empty.

Method:
See also: Utils#isEmpty()
Usage:

String one = "one";
String two = "two";
List<String> oneandtwolist = new ArrayList<>();
Map<String, String> oneandtwomap = new HashMap<>();
// true, the list and the map are empty       
boolean isanyempty = Utils.isAnyEmpty(one, two, oneandtwolist, oneandtwomap);

oneandtwolist.add(one);
oneandtwolist.add(two);
// true, the map is empty       
boolean isanyempty = Utils.isAnyEmpty(one, two, oneandtwolist, oneandtwomap);

oneandtwomap.put(one, one);
oneandtwomap.put(two, two);
// false, there is no empty values with respect to Utils#isEmpty()
boolean isanyempty = Utils.isAnyEmpty(one, two, oneandtwolist, oneandtwomap);

Niciun comentariu:

Trimiteți un comentariu