[WIP] Refactor toMap

I propose refactoring `toMap` and `toMultimap` to be more Scala idiomatic. This PR is my initial idea about `toMap`.

Any thoughts?

/cc @samuelgruetter @headinthebox
Plenty of questions when reading this code... And I guess you've already asked and answered most of them yourself while writing this code, so could you please share your insights with us? That's what source code comments or commit messages are good for ;-)