Paul Krill
Editor at Large

Scala 2.13 overhauls collections, improves the standard library

news
Jun 11, 20192 mins

The functional and object-oriented language with JVM and JavaScript runtimes gains performance, safety, and simplicity improvements

cross functional talent multi talented ballet ballerina skateboard versatile agile
Credit: PeopleImages / Getty Images

Scala, the functional and object-oriented programming language with JVM and JavaScript runtimes, is available in a new version. Scala 2.13 improves the standard library with an overhaul of collections, the addition of new classes and methods, and performance and stability improvements.

Collections in the standard library have been overhauled for performance, safety, and simplicity. Multiple improvements have been made to collections including:

  • Simpler method signatures. Transformation methods no longer take an implicit CanBuildFrom parameter.ย 
  • Simpler type hierarchy. Traversable and TraversableOnce have been deprecated to aliases for Iterable and IterableOnce.ย 
  • Parallel collections now are a separate module.
  • The Seq trait for sequences is now an alias for collection.immutable.Seq. Previously, it was a an alias for possibly mutable collection.Seq.
  • Simplified, workable views are featured, along with quicker HashMap/Set implementations.
  • Collection serialization has changed. Collections now use the serialization proxy pattern when possible.
  • SeqMap has been added as an abstraction type, with immutable.SeqMap providing immutable maps to maintain insertion order.

Also in the standard library, the Future capability is faster. Future represents a value that may or may not be currently available, or an exception if that value could not be made available. Extension methods for Java interoperability are now located in scala.jdk and explicit converters for Java are in scala.jdk.javaapi. The scala-java8-compat module Is now part of the standard library.

Other improvements in Scala 2.13:

  • The compiler promises to be 5% to 10% faster. It also features an improved optimizer and leverages deterministic output. The compiler will generate identical output for identical input in more cases, for reproducible builds. Operations on collections have been further optimized and inlining has been improved.
  • Literals for strings and integers now have associated types. Also, underscores now can be used as spacers.

Initially a JVM language, Scala has since added a runtime for JavaScript, with the introduction of Scala.js. You can find instructions for downloading Scala on the Scala website.

Paul Krill

Paul Krill is editor at large at InfoWorld. Paul has been covering computer technology as a news and feature reporter for more than 35 years, including 30 years at InfoWorld. He has specialized in coverage of software development tools and technologies since the 1990s, and he continues to lead InfoWorldโ€™s news coverage of software development platforms including Java and .NET and programming languages including JavaScript, TypeScript, PHP, Python, Ruby, Rust, and Go. Long trusted as a reporter who prioritizes accuracy, integrity, and the best interests of readers, Paul is sought out by technology companies and industry organizations who want to reach InfoWorldโ€™s audience of software developers and other information technology professionals. Paul has won a โ€œBest Technology News Coverageโ€ award from IDG.

More from this author