Improve firstIndexWhere() performance

firstIndexWhere() used to address the elements by index using
getFromFirst(). This is an O(n) operation for linked lists, making
firstIndexWhere() as a whole an O(n^2) operation for linked lists.
That can easily be avoided by using an iterator instead.