public static void applyActionRecursivelyOnEntities(Entity root,Consumer<Entity> action){
  action.accept(root);
  NodeComponent nodeComponent=ComponentRetriever.get(root,NodeComponent.class);
  if (nodeComponent != null && nodeComponent.children != null) {
    for (    Entity targetEntity : nodeComponent.children) {
      applyActionRecursivelyOnEntities(targetEntity,action);
    }
  }
}

public static void applyActionRecursivelyOnEntities ( Entity root , Consumer < Entity > action ) { action . accept ( root ) ; NodeComponent nodeComponent = ComponentRetriever . get ( root , NodeComponent . class ) ; if ( nodeComponent != null && nodeComponent . children != null ) { for ( Entity targetEntity : nodeComponent . children ) { applyActionRecursivelyOnEntities ( targetEntity , action ) ; } } }
iterate over children recursively and do some operations
