private static boolean isBlank(final Component component) {
    if (isText(component)) {
      final TextComponent textComponent = (TextComponent) component;

      final String content = textComponent.content();

      for (int i = 0; i < content.length(); i++) {
        final char c = content.charAt(i);
        if (c != ' ') return false;
      }

      return true;
    }
    return false;
  }
Checks whether the Component is blank (a TextComponent containing only space characters).

@param component the component to check
@return true if the provided component is blank, false otherwise
api/src/main/java/net/kyori/adventure/text/ComponentCompaction.java