clone method

  1. @override
Chain<T> clone()
override

An iterator which is a "clone" of the original iterator. Iterating through the original or the clone will not affect the other. Do not modify the original collection the original Iterable is based on while iterating. See Clone for more information.

Implementation

@override
Chain<T> clone() {
  final newFirst = Clone._trackable(_first);
  final newSecond = Clone._trackable(_second);
  _first = newFirst;
  _second = newSecond;
  return Chain(Clone._clone(newFirst), Clone._clone(newSecond))
    ..isFirst = isFirst;
}