Package io.confluent.csid.utils
Class LoopingResumingIterator<KEY,VALUE>
java.lang.Object
io.confluent.csid.utils.LoopingResumingIterator<KEY,VALUE>
- All Implemented Interfaces:
java.lang.Iterable<java.util.Map.Entry<KEY,VALUE>>,java.util.Iterator<java.util.Map.Entry<KEY,VALUE>>
public class LoopingResumingIterator<KEY,VALUE>
extends java.lang.Object
implements java.util.Iterator<java.util.Map.Entry<KEY,VALUE>>, java.lang.Iterable<java.util.Map.Entry<KEY,VALUE>>
Loop implementations that will resume from a given key. Can be constructed and used as an iterable, or a function
passed into the static version
iterateStartingFromKeyLooping(java.util.Optional<KEY>, java.util.LinkedHashMap<KEY, VALUE>, java.util.function.Consumer<java.util.Map.Entry<KEY, VALUE>>).
The non functional version is useful when you want to use looping constructs such as break and
continue.
-
Constructor Summary
Constructors Constructor Description LoopingResumingIterator(java.util.Map<KEY,VALUE> map)LoopingResumingIterator(java.util.Optional<KEY> startingKey, java.util.Map<KEY,VALUE> map)Will resume from the startingKey, if it's present -
Method Summary
Modifier and Type Method Description static <KKEY, VVALUE>
LoopingResumingIterator<KKEY,VVALUE>build(KKEY startingKey, java.util.Map<KKEY,VVALUE> map)java.util.Optional<KEY>getIterationStartingPoint()booleanhasNext()java.util.Iterator<java.util.Map.Entry<KEY,VALUE>>iterator()java.util.Map.Entry<KEY,VALUE>next()
-
Constructor Details
-
LoopingResumingIterator
Will resume from the startingKey, if it's present -
LoopingResumingIterator
-
-
Method Details
-
build
public static <KKEY, VVALUE> LoopingResumingIterator<KKEY,VVALUE> build(KKEY startingKey, java.util.Map<KKEY,VVALUE> map) -
hasNext
public boolean hasNext()- Specified by:
hasNextin interfacejava.util.Iterator<KEY>
-
next
- Specified by:
nextin interfacejava.util.Iterator<KEY>
-
iterator
- Specified by:
iteratorin interfacejava.lang.Iterable<KEY>
-
getIterationStartingPoint
-