Map() and its close cousin flatMap() are often used when we deal with data structures in Scala and both are higher-order functions.