Метод moveNext
bool moveNext(Переходит к следующему элементу.
Возвращает true, если current содержит следующий элемент. Возвращает false, если элементов больше нет.
Безопасно вызывать moveNext даже когда итератор уже расположен после последнего элемента. В этом случае moveNext снова возвращает false и не имеет эффекта.
Вызов moveNext может вызвать исключение, если итерация была прервана изменением базовой коллекции.
Исходный код
bool moveNext() {
_position = _nextPosition;
if (_position == string.length) {
_currentCodePoint = null;
return false;
}
int codeUnit = string.codeUnitAt(_position);
int nextPosition = _position + 1;
if (_isLeadSurrogate(codeUnit) && nextPosition < string.length) {
int nextCodeUnit = string.codeUnitAt(nextPosition);
if (_isTrailSurrogate(nextCodeUnit)) {
_nextPosition = nextPosition + 1;
_currentCodePoint = _combineSurrogatePair(codeUnit, nextCodeUnit);
return true;
}
}
_nextPosition = nextPosition;
_currentCodePoint = codeUnit;
return true;
}
© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/1.24.3/dart-core/RuneIterator/moveNext.html