If I had a List that looked like this:
List("abdera.apache.org lists:", "commits", "dev", "user",
"accumulo.apache.org lists:", "commits", "dev", "notifications", "user")
And I wanted to end with a
Map("abdera.apache.org lists:" -> Seq("commits", "dev", "user"),
"accumulo.apache.org lists:" -> Seq("commits", "dev", "notifications", "user"))
How would I do that?
I've been trying groupBy
, but I'm not sure how to apply a boolean to first get the key (i.e. string.contains("lists:")
) and then a boolean to the next element to test if it doesn't contain "lists:" and therefore add it as a value.