flatMap
方法(或屬性)屬於 scala.util.Either.LeftProjection
類(class),其相關用法說明如下。
用法:
def flatMap[A1, B1 >: B](f: A => Either[A1, B1]): Either[A1, B1]
跨Left
綁定給定函數.
Left(12).left.flatMap(x => Left("scala")) // Left("scala")
Right(12).left.flatMap(x => Left("scala")) // Right(12)
值參數:
- f
跨
Left
綁定的函數.
源碼:
- Either.scala
相關用法
- Scala LeftProjection.forall用法及代碼示例
- Scala LeftProjection.filter用法及代碼示例
- Scala LeftProjection.filterToOption用法及代碼示例
- Scala LeftProjection.foreach用法及代碼示例
- Scala LeftProjection.toOption用法及代碼示例
- Scala LeftProjection.toSeq用法及代碼示例
- Scala LeftProjection.map用法及代碼示例
- Scala LeftProjection.getOrElse用法及代碼示例
- Scala LeftProjection.get用法及代碼示例
- Scala LeftProjection.exists用法及代碼示例
- Scala LeftPartitionMapped.unzip用法及代碼示例
- Scala LeftPartitionMapped.sliding用法及代碼示例
- Scala LeftPartitionMapped.partitionMap用法及代碼示例
- Scala LeftPartitionMapped.sizeIs用法及代碼示例
- Scala LeftPartitionMapped.groupBy用法及代碼示例
- Scala LeftPartitionMapped.tails用法及代碼示例
- Scala LeftPartitionMapped.transpose用法及代碼示例
- Scala LeftPartitionMapped.unzip3用法及代碼示例
- Scala LeftPartitionMapped.groupMap用法及代碼示例
- Scala LeftPartitionMapped.scanRight用法及代碼示例
- Scala LeftPartitionMapped.collectFirst用法及代碼示例
- Scala LeftPartitionMapped.addString用法及代碼示例
- Scala LeftPartitionMapped.inits用法及代碼示例
- Scala LeftPartitionMapped.sizeCompare用法及代碼示例
- Scala LeftPartitionMapped.groupMapReduce用法及代碼示例
注:本文由純淨天空篩選整理自scala-lang.org大神的英文原創作品 LeftProjection.flatMap。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。