に出くわしましandThenたが、よくわかりませんでした。
さらに詳しく調べるために、Function1.andThenドキュメントを読みました
def andThen[A](g: (R) ⇒ A): (T1) ⇒ A
mmMultiMapインスタンスです。
scala> mm
res29: scala.collection.mutable.HashMap[Int,scala.collection.mutable.Set[String]] with scala.collection.mutable.MultiMap[Int,String] =
Map(2 -> Set(b) , 1 -> Set(c, a))
scala> mm.keys.toList.sortWith(_ < _).map(mm.andThen(_.toList))
res26: List[List[String]] = List(List(c, a), List(b))
scala> mm.keys.toList.sortWith(_ < _).map(x => mm.apply(x).toList)
res27: List[List[String]] = List(List(c, a), List(b))
andThen強力ですか?この例に基づくと、mm.andThen脱糖のように見えx => mm.apply(x)ます。にもっと深い意味があるとすればandThen、私はまだそれを理解していません。