Class Strings


  • @ParametersAreNonnullByDefault
    public final class Strings
    extends Object
    Static utility methods related to String.
    • Method Detail

      • isNullOrEmpty

        public static boolean isNullOrEmpty​(@Nullable
                                            String s)
        Returns true if the given string is null or is the empty string.
        Parameters:
        s - a string reference to check
        Returns:
        true if the string is null or is the empty string
      • nullToEmpty

        @Nonnull
        public static String nullToEmpty​(@Nullable
                                         String s)
        Returns the given string if it is non-null; the empty string otherwise.
        Parameters:
        s - the string to test and possibly return
        Returns:
        s itself if it is non-null; EMPTY if it is null
      • emptyToNull

        @CheckForNull
        public static String emptyToNull​(@Nullable
                                         String s)
        Returns the given string if it is nonempty; null otherwise.
        Parameters:
        s - the string to test and possibly return
        Returns:
        s itself if it is nonempty; null if it is empty or null
      • isBinary

        public static boolean isBinary​(String value)
        Returns true if the value represents an hexadecimal value.
        Parameters:
        value - the string to test
        Returns:
        true if the value represents an hexadecimal value