I was just wondering if there is a specific reason why Pair doesn't implement Iterable. The case I encountered was to flatten a list of pairs (List<Pair<A,A>> to List<A>). I've written the following
listOfPairs flatMap { listOf(it.first, it.second) }
If Pair implemented Iterable it would have been
listOfPairs flatMap { it }
// or if there was an identity function
listOfPairs flatMap id
But I'm sure there would be other use cases for Pair implementing Iterable, too.
Btw, if there is a better way to flatten a list of pairs, please let me know.
Thanks,
Eugen