indexWhere method

int indexWhere(
  1. bool test(
    1. E element
    ), [
  2. int start = 0
])

Iterate over the set and return the first element matching test.

If start is not null, the starting index will be changed. If no elements match test, then -1 is returned.

Implementation

int indexWhere(bool test(E element), [int start = 0]) {
  for (int i = start; i < length; i++) {
    E value = elementAt(i);
    if (test(value)) return i;
  }

  return -1;
}