java.lang.Object
me.sbasalaev.collection.Iterators
Factory methods for iterators.
All iterators produced by this class are read only and do not support remove().
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Iterator<T> Concatenates two iterators together.counting(int start) Infinite iterator counting integers starting from given one.static <T> Iterator<T> empty()Empty iterator.static <T> Iterator<T> Filters out iterator elements that do not satisfycondition.static <T> Iterator<T> Limits number of elements produced byiteratorbycap.static <T,R> Iterator <R> Appliesmappingto all elements ofiterator.static <T> Iterator<T> of(T... elements) Iterator over given elements in given order.static <T> Iterator<T> ofRange(T[] elements, int offset, int size) Iterator over range of given array.static <T> Iterator<T> Takes values fromiteratoruntil givenconditionfails.Wraps elements produced by given iterator intoOptvalues.static <T,U, R> Iterator <R> zipBy(Iterator<T> first, Iterator<U> second, BiFunction<? super T, ? super U, ? extends R> combiner) Combines values produced by iterators usingcombiner.
-
Method Details
-
empty
Empty iterator. -
of
Iterator over given elements in given order. -
ofRange
Iterator over range of given array.- Since:
- 3.2
-
counting
Infinite iterator counting integers starting from given one. -
wrapped
Wraps elements produced by given iterator intoOptvalues.- Since:
- 3.2
-
filter
Filters out iterator elements that do not satisfycondition. -
map
Appliesmappingto all elements ofiterator. -
chain
Concatenates two iterators together. The result first yields elements of thefirstiterator, and once it is exhausted, elements of thesecond. -
zipBy
public static <T,U, Iterator<R> zipByR> (Iterator<T> first, Iterator<U> second, BiFunction<? super T, ? super U, ? extends R> combiner) Combines values produced by iterators usingcombiner. -
limit
Limits number of elements produced byiteratorbycap. -
takeWhile
Takes values fromiteratoruntil givenconditionfails.
-