Package ball.util
Class Walker<T>
- java.lang.Object
-
- java.util.Spliterators.AbstractSpliterator<T>
-
- ball.util.Walker<T>
-
- Type Parameters:
T
- The type of node.
- All Implemented Interfaces:
Spliterator<T>
public class Walker<T> extends Spliterators.AbstractSpliterator<T>
- Author:
- Allen D. Ball
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface java.util.Spliterator
Spliterator.OfDouble, Spliterator.OfInt, Spliterator.OfLong, Spliterator.OfPrimitive<T extends Object,T_CONS extends Object,T_SPLITR extends Spliterator.OfPrimitive<T,T_CONS,T_SPLITR>>
-
-
Field Summary
-
Fields inherited from interface java.util.Spliterator
CONCURRENT, DISTINCT, IMMUTABLE, NONNULL, ORDERED, SIZED, SORTED, SUBSIZED
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
tryAdvance(Consumer<? super T> consumer)
Spliterator<T>
trySplit()
static <T> Stream<T>
walk(Collection<? extends T> roots, Function<? super T,Collection<? extends T>> childrenOf)
Entry-point to create aStream
for traversing a tree of type<T>
nodes.static <T> Stream<T>
walk(T root, Function<? super T,Collection<? extends T>> childrenOf)
Entry-point to create aStream
for traversing a tree of type<T>
nodes.-
Methods inherited from class java.util.Spliterators.AbstractSpliterator
characteristics, estimateSize
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Spliterator
forEachRemaining, getComparator, getExactSizeIfKnown, hasCharacteristics
-
-
-
-
Method Detail
-
trySplit
public Spliterator<T> trySplit()
- Specified by:
trySplit
in interfaceSpliterator<T>
- Overrides:
trySplit
in classSpliterators.AbstractSpliterator<T>
-
tryAdvance
public boolean tryAdvance(Consumer<? super T> consumer)
-
walk
public static <T> Stream<T> walk(T root, Function<? super T,Collection<? extends T>> childrenOf)
-
walk
public static <T> Stream<T> walk(Collection<? extends T> roots, Function<? super T,Collection<? extends T>> childrenOf)
-
-