foreach
方法(或屬性)屬於 scala.util.Either.RightProjection
類(class),其相關用法說明如下。
用法:
def foreach[U](f: B => U): Unit
如果這是 Right
,則執行給定的 side-effecting 函數.
Right(12).right.foreach(x => println(x)) // prints "12"
Left(12).right.foreach(x => println(x)) // doesn't print
值參數:
- f
要執行的side-effecting 函數。
源碼:
- Either.scala
相關用法
- Scala RightProjection.forall用法及代碼示例
- Scala RightProjection.filter用法及代碼示例
- Scala RightProjection.filterToOption用法及代碼示例
- Scala RightProjection.get用法及代碼示例
- Scala RightProjection.toSeq用法及代碼示例
- Scala RightProjection.toOption用法及代碼示例
- Scala RightProjection.getOrElse用法及代碼示例
- Scala RightProjection.map用法及代碼示例
- Scala RightProjection.exists用法及代碼示例
- Scala RightPartitionMapped.collectFirst用法及代碼示例
- Scala RightPartitionMapped.sizeIs用法及代碼示例
- Scala RightPartitionMapped.partitionMap用法及代碼示例
- Scala RightPartitionMapped.transpose用法及代碼示例
- Scala RightPartitionMapped.unzip3用法及代碼示例
- Scala RightPartitionMapped.tails用法及代碼示例
- Scala RightPartitionMapped.sizeCompare用法及代碼示例
- Scala RightPartitionMapped.scanRight用法及代碼示例
- Scala RightPartitionMapped.groupMapReduce用法及代碼示例
- Scala RightPartitionMapped.addString用法及代碼示例
- Scala RightPartitionMapped.mkString用法及代碼示例
- Scala RightPartitionMapped.groupMap用法及代碼示例
- Scala RightPartitionMapped.inits用法及代碼示例
- Scala RightPartitionMapped.lazyZip用法及代碼示例
- Scala RightPartitionMapped.groupBy用法及代碼示例
- Scala RightPartitionMapped.sliding用法及代碼示例
注:本文由純淨天空篩選整理自scala-lang.org大神的英文原創作品 RightProjection.foreach。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。