java.lang.Object
io.modelcontextprotocol.util.Utils

public final class Utils extends Object
Miscellaneous utility methods.
Author:
Christian Tzolov
  • Constructor Details

    • Utils

      public Utils()
  • Method Details

    • hasText

      public static boolean hasText(@Nullable String str)
      Check whether the given String contains actual text.

      More specifically, this method returns true if the String is not null, its length is greater than 0, and it contains at least one non-whitespace character.

      Parameters:
      str - the String to check (may be null)
      Returns:
      true if the String is not null, its length is greater than 0, and it does not contain whitespace only
      See Also:
    • isEmpty

      public static boolean isEmpty(@Nullable Collection<?> collection)
      Return true if the supplied Collection is null or empty. Otherwise, return false.
      Parameters:
      collection - the Collection to check
      Returns:
      whether the given Collection is empty
    • isEmpty

      public static boolean isEmpty(@Nullable Map<?,?> map)
      Return true if the supplied Map is null or empty. Otherwise, return false.
      Parameters:
      map - the Map to check
      Returns:
      whether the given Map is empty