concept key - value structure in category scala

appears as: key-value structure, A key-value structure
Get Programming with Scala

This is an excerpt from Manning's book Get Programming with Scala.

You can use the method groupBy on a sequence to group elements based on their characteristics by producing a key-value structure called “map”. For an instance of List[A], the function groupBy takes a parameter f with type A => B, and it returns a value of type Map[B, List[A]] – you are going to learn about the type Map in the next unit. The function groupBy uses the function f to determine each key of the dictionary and its corresponding values.

After reading this lesson, you will be able to:

scala> Map("Rome" -> "Italy", "London" -> "UK").map { 
     |    case (capital, country) => country -> capital
     | }
res1: scala.collection.immutable.Map[String,String] = 
Map(Italy -> Rome, UK -> London)