Scala parallel map example: Using a parallel map to transform a collection of String to all-uppercase

Using a parallel map to transform a collection of String to all-uppercase

scala> val lastNames = List("Smith","Jones","Frankenstein","Bach","Jackson","Rodin").par
lastNames: scala.collection.parallel.immutable.ParSeq[String] 
       = ParVector(Smith, Jones, Frankenstein, Bach, Jackson, Rodin)

scala> lastNames.map(_.toUpperCase)
res0: scala.collection.parallel.immutable.ParSeq[String] 
       = ParVector(SMITH, JONES, FRANKENSTEIN, BACH, JACKSON, RODIN)

See the URL for more information.

Add new comment

The content of this field is kept private and will not be shown publicly.

Anonymous format

  • Allowed HTML tags: <em> <strong> <cite> <code> <ul type> <ol start type> <li> <pre>
  • Lines and paragraphs break automatically.