E elementAt(
int index

Returns the indexth element.

The index must be non-negative and less than length. Index zero represents the first element (so iterable.elementAt(0) is equivalent to iterable.first).

May iterate through the elements in iteration order, skipping the first index elements and returning the next. Some iterable may have more efficient ways to find the element.


E elementAt(int index) {
  if (index is! int) throw new ArgumentError.notNull("index");
  RangeError.checkNotNegative(index, "index");
  int elementIndex = 0;
  for (E element in this) {
    if (index == elementIndex) return element;
  throw new RangeError.index(index, this, "index", null, elementIndex);