void (@NotNull Component component, @NotNull Consumer<? super Component> action) { action.consume(component); if (component instanceof Container) { for (Component c : ((Container)component).getComponents()) { forEachComponentInHierarchy(c, action); } } }