, , clone().
This is one of the reasons you can use copy constructors instead clone()if they are available.
By the way, in your code, when the constructor is used RawStringIterator(RawStringIterator i), the first initialization is stateStacknot needed:
class RawStringIterator {
Stack<State> stateStack = new Stack<State>();
RawStringIterator(RawStringIterator i) {
stateStack = (Stack<State>) i.stateStack.clone();
}
}
You might want to remove this.
source
share