rapt
rapt

Reputation: 12220

What is the first of the two type parameters of the function passed to a `collect` method in Scala?

Why does the method

def collect[B](pf: PartialFunction[A, B]): List[B]

declared with the method only being dependent on the type B (collect[B])?

The signature shows this method depends on both A and B.

Upvotes: 0

Views: 41

Answers (1)

Databyte
Databyte

Reputation: 1481

It depends on A but A is already determined by the Type you created the list of, because collect is a function of the class List[A].

Upvotes: 3

Related Questions