int count(int index) { var value = indices[index]; int count = 1; // ignore: parameter_assignments while (++index < indices.length && indices[index] == value) { count++; } return count; }