T
- type of elements returned by this iterablepublic class MemorisingIterable<T> extends Object implements Iterable<T>
MemorisingIterable.MemorisingIterator
instances, so further data traversal analysis is possible.
Example usage:
public void testMyFunction() {
// provided
final MemorisingIterable<Integer> data = new MemorisingIterable<>(Arrays.asList(1, 2, 3, 4, 5));
// when
callMyFunction(data);
// then
assertThat(data.getGeneratedIterators(), hasSize(1));
assertThat(data.getGeneratedIterators().get(0).getTraversedElements(), contains(1, 2, 3));
}
Modifier and Type | Class and Description |
---|---|
static class |
MemorisingIterable.MemorisingIterator<T>
Iterator which memorises all traversed elements.
|
Constructor and Description |
---|
MemorisingIterable(Iterable<T> iterable)
Creates new instance of the
MemorisingIterable backed by the given iterable . |
Modifier and Type | Method and Description |
---|---|
List<MemorisingIterable.MemorisingIterator<T>> |
getGeneratedIterators()
Returns a list of all iterators created by calling
Iterable.iterator() on this object. |
Iterator<T> |
iterator() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public MemorisingIterable(@NotNull Iterable<T> iterable)
MemorisingIterable
backed by the given iterable
.@NotNull public List<MemorisingIterable.MemorisingIterator<T>> getGeneratedIterators()
Iterable.iterator()
on this object.Copyright © 2019 Atlassian Software Systems Pty Ltd. All rights reserved.