Scala - How to convert a Seq[A] to a Map[Int, A] using a value of A as the key in the map? Code Example

The code for How to convert a Seq[A] to a Map[Int, A] using a value of A as the key in the map?

val map = Map(seq map { a => a.key -> a }: _*)
Code by IncludeHelp, on August 14, 2022 20:17

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.