A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://scala-lang.org/api/3.x/scala/util/ChainingOps.html below:

ChainingOps

scala.util.ChainingOps

Adds chaining methods tap and pipe to every type.

Attributes
Source
ChainingOps.scala
Graph
Supertypes
Members list

Converts the value by applying the function f.

Converts the value by applying the function f.

scala> import scala.util.chaining._

scala> val times6 = (_: Int) * 6
times6: Int => Int = $$Lambda$2023/975629453@17143b3b

scala> val i = (1 - 2 - 3).pipe(times6).pipe(scala.math.abs)
i: Int = 24

Note: (1 - 2 - 3).pipe(times6) may have a small amount of overhead at runtime compared to the equivalent { val temp = 1 - 2 - 3; times6(temp) }.

Type parameters
B

the result type of the function f.

Value parameters
f

the function to apply to the value.

Attributes
Returns

a new value resulting from applying the given function f to this value.

Source
ChainingOps.scala

Applies f to the value for its side effects, and returns the original value.

Applies f to the value for its side effects, and returns the original value.

scala> import scala.util.chaining._

scala> val xs = List(1, 2, 3).tap(ys => println("debug " + ys.toString))
debug List(1, 2, 3)
xs: List[Int] = List(1, 2, 3)
Type parameters
U

the result type of the function f.

Value parameters
f

the function to apply to the value.

Attributes
Returns

the original value self.

Source
ChainingOps.scala

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4