Scala 2.13 overhauls collections, improves the standard library
- 12 June, 2019 07:21
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
- Simpler type hierarchy.
TraversableOncehave been deprecated to aliases for
- Parallel collections now are a separate module.
Seqtrait for sequences is now an alias for
collection.immutable.Seq. Previously, it was a an alias for possibly mutable
- Simplified, workable views are featured, along with quicker
- Collection serialization has changed. Collections now use the serialization proxy pattern when possible.
SeqMaphas been added as an abstraction type, with i
mmutable.SeqMapproviding 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-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.