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 ComponentPathIterator
create
(String rootName, Collection<? extends Component> components) Creates aComponentPathIterator
to recursively iterate on the provided components.createStream
(String rootName, Collection<? extends Component> components) Creates aStream
ofComponentPathIterator.ComponentWithPath
which recursively iterates on the provided components.boolean
hasNext()
next()
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining, remove
-
Method Details
-
create
@Nonnull public static ComponentPathIterator create(@Nonnull String rootName, @Nonnull Collection<? extends Component> components) Creates aComponentPathIterator
to 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 aStream
ofComponentPathIterator.ComponentWithPath
which recursively iterates on the provided components.- Parameters:
components
- The components to iterate on- Returns:
- A new, ordered
Stream
ofComponentPathIterator.ComponentWithPath
-
hasNext
public boolean hasNext()- Specified by:
hasNext
in interfaceIterator<ComponentPathIterator.ComponentWithPath>
-
next
- Specified by:
next
in interfaceIterator<ComponentPathIterator.ComponentWithPath>
-