What types in core scala library implement flatMap? I’ve seen it in Option and collections. Any other?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In short: all types which are monadic.
flatMapis such a common operation that there are a lot of types which can implement it. There are mainly two sort of types which implement it: containers and types which are useful to be sequenced. A small overview over some types:The first category contains
List,Seq,SetorMap(flatMapis defined is GenTraversableOnce)The second category contains
A useful way to find out all method names called
flatMapis to open Scaladoc on letterF(below the search bar). Then search forflatMapwith your browser and you will find all types containing the method.