2

I am trying to convert Future[Seq[(String, String)]] to Future[Seq[(String)]] using the following:

sortedSeq.map(_._2)

so sortedSeq is of type Future[Seq[(String, String)]]

but I keep getting the error :

 value _2 is not a member of Seq[(String, String)]

What am I doing wrong ?

princess of persia
  • 2,222
  • 4
  • 26
  • 43

1 Answers1

5

sortedSeq.map will apply the mapping to the Future, but you want it to apply to the elements of the Seq inside the future.

So something like:

sortedSeq.map(_.map(_._2))

so you map on the contents of the Seq in the future.

If you have a code sample that produces this to try it out it may be easier.

Michael Neale
  • 19,248
  • 19
  • 77
  • 109