Class Strings

java.lang.Object
de.espirit.common.tools.Strings

public final class Strings extends Object
Generic utility to provide string related operations.
Since:
5.2.21
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    implode(@NotNull Collection<?> objects, @NotNull String delimiter)
    Generates a string which contains all string values of the specified collection, separated by the given delimiter.
    static boolean
    isEmpty(@Nullable String string)
    Checks whether or not the specified string is empty.
    static boolean
    notEmpty(@Nullable String string)
    Checks whether or not the specified string is not empty.
    static @NotNull String
    notNull(@Nullable String string)
    Returns the specified string, or an empty string if the specified string is null.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Strings

      public Strings()
  • Method Details

    • notNull

      @NotNull public static @NotNull String notNull(@Nullable @Nullable String string)
      Returns the specified string, or an empty string if the specified string is null.
      Parameters:
      string - the string which could be null
      Returns:
      the specified or empty string
      Since:
      5.2.21
    • isEmpty

      public static boolean isEmpty(@Nullable @Nullable String string)
      Checks whether or not the specified string is empty.
      Parameters:
      string - the string to be checked for emptiness
      Returns:
      is empty or not?
      Since:
      5.2.21
    • notEmpty

      public static boolean notEmpty(@Nullable @Nullable String string)
      Checks whether or not the specified string is not empty.
      Parameters:
      string - the string to be checked for emptiness
      Returns:
      is empty or not?
      Since:
      5.2.190400
    • implode

      public static String implode(@NotNull @NotNull Collection<?> objects, @NotNull @NotNull String delimiter)
      Generates a string which contains all string values of the specified collection, separated by the given delimiter.
      Parameters:
      objects - the objects to get an imploded string representation from.
      delimiter - the delimiter to use for string creation.
      Returns:
      the imploded string representation.
      Since:
      5.2.21