1 package info.globalcode.sql.dk;
3 import java.util.ArrayList;
4 import java.util.Collection;
9 * @author Ing. František Kučera (frantovo.cz)
11 public class Functions {
16 public static boolean equalz(Object a, Object b) {
17 return a == null ? b == null : a.equals(b);
22 * @param text String to be examinated
23 * @param trim whether text should be trimmed before examination
24 * @return whether text is not empty and one or more characters long (after prospective trim)
26 public static boolean isEmpty(String text, boolean trim) {
33 return text.isEmpty();
38 * @see #isEmpty(java.lang.String, boolean)
40 public static boolean isNotEmpty(String text, boolean trim) {
41 return !isEmpty(text, trim);
44 public boolean isEmpty(Collection c) {
45 return c == null || c.isEmpty();
48 public boolean isNotEmpty(Collection c) {
52 public boolean isEmpty(Map m) {
53 return m == null || m.isEmpty();
56 public boolean isNotEmpty(Map m) {
61 * @return empty collection if given one is null | or the original one
63 public static <T> Collection<T> notNull(Collection<T> c) {
65 return new ArrayList<>();