@Override public @NonNull B mapChildrenDeep(final @NonNull Function<BuildableComponent<? ,?>, BuildableComponent<? ,?>> function) { if(this.children == EMPTY_COMPONENT_LIST) { return (B) this; } final ListIterator<Component> it = this.children.listIterator(); while(it.hasNext()) { final Component child = it.next(); if(!(child instanceof BuildableComponent)) { continue; } final BuildableComponent mappedChild = function.apply((BuildableComponent) child); if(mappedChild.children().isEmpty()) { if(child == mappedChild) { continue; } it.set(mappedChild); } else { final Builder<?, ?> builder = mappedChild.toBuilder(); builder.mapChildrenDeep(function); it.set(builder.build()); } } return (B) this; }
@Override @SuppressWarnings({"rawtypes", "unchecked"}) public @NonNull B mapChildrenDeep(final @NonNull Function<BuildableComponent<? ,?>, BuildableComponent<? ,?>> function) { if(this.children == EMPTY_COMPONENT_LIST) { return (B) this; } final ListIterator<Component> it = this.children.listIterator(); while(it.hasNext()) { final Component child = it.next(); if(!(child instanceof BuildableComponent)) { continue; } final BuildableComponent mappedChild = function.apply((BuildableComponent) child); if(mappedChild.children().isEmpty()) { if(child == mappedChild) { continue; } it.set(mappedChild); } else { final Builder<?, ?> builder = mappedChild.toBuilder(); builder.mapChildrenDeep(function); it.set(builder.build()); } } return (B) this; }
@Override @SuppressWarnings({"rawtypes", "unchecked"}) public @NonNull B mapChildrenDeep(final @NonNull Function<BuildableComponent<? ,?>, BuildableComponent<? ,?>> function) { if(this.children == EMPTY_COMPONENT_LIST) { return (B) this; } final ListIterator<Component> it = this.children.listIterator(); while(it.hasNext()) { final Component child = it.next(); if(!(child instanceof BuildableComponent)) { continue; } final BuildableComponent mappedChild = function.apply((BuildableComponent) child); if(mappedChild.children().isEmpty()) { if(child == mappedChild) { continue; } it.set(mappedChild); } else { final Builder<?, ?> builder = mappedChild.toBuilder(); builder.mapChildrenDeep(function); it.set(builder.build()); } } return (B) this; }