[scala] Change input of grouped ops from TraversableOnce to Iterator

Iterator is a subclass of TraversableOnce, so it doesn't break existing
code. We can have an Iterator anyways and it provides more functions for
the user.