Don't use Iterator::takeWhile().

It messes up the internal iterator state so it's not usable after
the call, which we need here. (Mental note: read all the scaladoc
next time.)