Package com.google.protobuf
Class RopeByteString.PieceIterator
- java.lang.Object
-
- com.google.protobuf.RopeByteString.PieceIterator
-
- All Implemented Interfaces:
java.util.Iterator<ByteString.LeafByteString>
- Enclosing class:
- RopeByteString
private static final class RopeByteString.PieceIterator extends java.lang.Object implements java.util.Iterator<ByteString.LeafByteString>
This class is a continuable tree traversal, which keeps the state information which would exist on the stack in a recursive traversal instead on a stack of "Bread Crumbs". The maximum depth of the stack in this iterator is the same as the depth of the tree being traversed.This iterator is used to implement
RopeByteString.equalsFragments(ByteString)
.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.ArrayDeque<RopeByteString>
breadCrumbs
private ByteString.LeafByteString
next
-
Constructor Summary
Constructors Modifier Constructor Description private
PieceIterator(ByteString root)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private ByteString.LeafByteString
getLeafByLeft(ByteString root)
private ByteString.LeafByteString
getNextNonEmptyLeaf()
boolean
hasNext()
ByteString.LeafByteString
next()
Returns the next item and advances oneByteString.LeafByteString
.void
remove()
-
-
-
Field Detail
-
breadCrumbs
private final java.util.ArrayDeque<RopeByteString> breadCrumbs
-
next
private ByteString.LeafByteString next
-
-
Constructor Detail
-
PieceIterator
private PieceIterator(ByteString root)
-
-
Method Detail
-
getLeafByLeft
private ByteString.LeafByteString getLeafByLeft(ByteString root)
-
getNextNonEmptyLeaf
private ByteString.LeafByteString getNextNonEmptyLeaf()
-
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interfacejava.util.Iterator<ByteString.LeafByteString>
-
next
public ByteString.LeafByteString next()
Returns the next item and advances oneByteString.LeafByteString
.- Specified by:
next
in interfacejava.util.Iterator<ByteString.LeafByteString>
- Returns:
- next non-empty LeafByteString or
null
-
remove
public void remove()
- Specified by:
remove
in interfacejava.util.Iterator<ByteString.LeafByteString>
-
-