Class Iterators
java.lang.Object
io.atlassian.fugue.Iterators
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classA template implementation of theIteratorinterface, so clients can more easily implement Iterator for some patterns of iteration.private static enum(package private) static interfaceMarker interface for use in constructing iterators(package private) static interfaceIterator that can examine next without removing itprivate static classImplementation of Iterators.Peeking that avoids peeking unless necessary.(package private) static classIterator whereIterators.Unmodifiable.remove()is unsupported. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static <A> booleanaddAll(Collection<A> collectionToModify, Iterator<? extends A> iterator) Adds all the elements of the iterator to the collectionToModifystatic <A> Iterator<A> Iterator with no values inside(package private) static <A> Iterators.Peeking<A> peekingIterator(Iterator<? extends A> iterator) Wrap an iterator to add support for the peek operation.(package private) static <A> Iterator<A> singletonIterator(A a) Iterator that returns a single element
-
Constructor Details
-
Iterators
Iterators()
-
-
Method Details
-
addAll
Adds all the elements of the iterator to the collectionToModify- Type Parameters:
A- element type- Parameters:
collectionToModify- collection to add element to, must not be nulliterator- source of elements to add, must not be null- Returns:
- true if any of the elements from iterator were not also in collectionToModify
- Since:
- 3.0
-
peekingIterator
Wrap an iterator to add support for the peek operation. Do not maintain a reference to the iterator passed in as a parameter. Iterators are mutable by nature and this function makes no promises about how or when the input iterator will be mutated.- Type Parameters:
A- element type- Parameters:
iterator- iterator that may not support peek, must not be null- Returns:
- an iterator for which
peekwill return Iterator#next without removing the value from the iterator - Since:
- 3.0
-
singletonIterator
Iterator that returns a single element- Type Parameters:
A- element type- Parameters:
a- element to return- Returns:
- iterator returning only a
- Since:
- 3.0
-
emptyIterator
Iterator with no values inside- Type Parameters:
A- element type- Returns:
- empty iterator
- Since:
- 3.0
-