default boolean contains(final @NotNull Component that, final @NotNull BiPredicate<? super Component, ? super Component> equals) {
    if (equals.test(this, that)) return true;
    for (final Component child : this.children()) {
      if (child.contains(that, equals)) return true;
    }
    final @Nullable HoverEvent<?> hoverEvent = this.hoverEvent();
    if (hoverEvent != null) {
      final Object value = hoverEvent.value();
      Component component = null;
      if (value instanceof Component) {
        component = (Component) hoverEvent.value();
      } else if (value instanceof HoverEvent.ShowEntity) {
        component = ((HoverEvent.ShowEntity) value).name();
      }
      if (component != null) {
        if (equals.test(that, component)) return true;
        for (final Component child : component.children()) {
          if (child.contains(that, equals)) return true;
        }
      }
    }
    return false;
  }
Checks if this component contains a component.

@param that the other component
@param equals the equality tester
@return {@code true} if this component contains the provided
    component, {@code false} otherwise
@since 4.8.0
api/src/main/java/net/kyori/adventure/text/Component.java