W3cubDocs

/Dart 2

forEach method

void forEach (void action(E entry))

Call action with each entry in this linked list.

It's an error if action modify the linked list.

Implementation

void forEach(void action(E entry)) {
  int modificationCount = _modificationCount;
  if (isEmpty) return;

  E current = _first;
  do {
    action(current);
    if (modificationCount != _modificationCount) {
      throw new ConcurrentModificationError(this);
    }
    current = current._next;
  } while (!identical(current, _first));
}

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/2.0.0/dart-collection/LinkedList/forEach.html