Class ComponentPathIterator
java.lang.Object
net.dv8tion.jda.api.components.utils.ComponentPathIterator
- All Implemented Interfaces:
Iterator<ComponentPathIterator.ComponentWithPath>
public class ComponentPathIterator
extends Object
implements Iterator<ComponentPathIterator.ComponentWithPath>
Utility class to recursively iterate on a list of components while keeping track their path.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic ComponentPathIteratorcreate(String rootName, Collection<? extends Component> components) Creates aComponentPathIteratorto recursively iterate on the provided components.createStream(String rootName, Collection<? extends Component> components) Creates aStreamofComponentPathIterator.ComponentWithPathwhich recursively iterates on the provided components.booleanhasNext()next()Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Iterator
forEachRemaining, remove
-
Method Details
-
create
@Nonnull public static ComponentPathIterator create(@Nonnull String rootName, @Nonnull Collection<? extends Component> components) Creates aComponentPathIteratorto recursively iterate on the provided components.- Parameters:
components- The components to iterate on- Returns:
- A new
ComponentPathIterator
-
createStream
@Nonnull public static Stream<ComponentPathIterator.ComponentWithPath> createStream(@Nonnull String rootName, @Nonnull Collection<? extends Component> components) Creates aStreamofComponentPathIterator.ComponentWithPathwhich recursively iterates on the provided components.- Parameters:
components- The components to iterate on- Returns:
- A new, ordered
StreamofComponentPathIterator.ComponentWithPath
-
hasNext
public boolean hasNext()- Specified by:
hasNextin interfaceIterator<ComponentPathIterator.ComponentWithPath>
-
next
- Specified by:
nextin interfaceIterator<ComponentPathIterator.ComponentWithPath>
-