Class EmptyCheckUtils


  • public final class EmptyCheckUtils
    extends Object
    This class is used to avoid NPE: NullPointerException easily.
    Since:
    1.0.0
    Author:
    Bal Vikash Sharma
    • Method Detail

      • isNullEmpty

        public static boolean isNullEmpty​(Object obj)
        This method used to check if given obj is null.
        Parameters:
        obj - is of any java.lang.Object type.
        Returns:
        true if obj is null.
      • isNullEmpty

        public static boolean isNullEmpty​(String str)
        This method is used to check if the given str is null or an empty string.
        Parameters:
        str - id of type java.lang.String
        Returns:
        true if given str is null or length of it is Zero after trim.
      • isNullEmpty

        public static boolean isNullEmpty​(Collection<?> collection)
        This method is used to check given collection is null or is Empty.
        Parameters:
        collection - is of type java.util.Collection.
        Returns:
        true if given collection is null or does not contains any element inside it.
      • isNullEmpty

        public static boolean isNullEmpty​(Map<?,​?> map)
        This method is used to check given map is null or is Empty.
        Parameters:
        map - is of type java.util.Map
        Returns:
        true if given map is null or does not contains any key, values pairs inside it.