Skip to content
This repository was archived by the owner on Dec 22, 2021. It is now read-only.
Lukas Rytz edited this page Feb 5, 2018 · 90 revisions

This page should evolve over time, but already be useful now. When more official documentation is available, content can be replaced by links.

Collection Users

What are the breaking changes?

  • collection.breakOut no longer exists
  • Method to[C] was removed
  • MapProxy, SetProxy no longer exist
  • SynchronizedX no longer exist
  • SeqForwarder no longer exists
  • Implicit conversions between Scala and Java collections no longer exist (convert.ImplicitConversions / ImplicitConversionsToJava / ImplicitConversionsToScala) -- NOTE: they are not deprecated in 2.12.
  • MutableList is no longer public
  • TreeMap / TreeSet / BitSet: the to method is now called rangeTo
  • immutable.Set/Map: the + method no longer has an overload accepting multiple values, so Set(1) + (2, 3) is now Set(1) + 2 + 3
  • mutable.Set/Map no longer has a + method, so mutable.Set(1) + 2 is now mutable.Set(1).clone() += 2 (https://github.com/scala/collection-strawman/issues/375)
  • mutable.Set/Map no longer has an updated method, so mutable.Map(1 -> 2).updated(1, 3) is no mutable.Map(1 -> 2).clone() += 1 -> 3
  • Iterable no longer has a sameElements method, call .iterator() first
  • colleciton.Seq.union no longer exists, use ++
  • collection.Map no longer has - or -- methods
  • LinearSeq no longer has a companion-apply, use List()
  • HashSet.remove now returns an Option[A] instead of a Boolean
  • Iterable.partition invokes iterator twice and assumes it gets two iterators over the same elements. Strict subclasses override partition do perform only a single traversal.
  • List.union no longer exists, use :::

Are there new collection types?

Are there new operations on collections?

Are there new implementations of existing collection types (changes in performance characteristics)?

How do I cross-build my project against Scala 2.12 and Scala 2.13?

  • Compat library
  • Accept some deprecation warnings (?)
  • sbt's version-specific source folders if necessary, but should not be

Does scala.Seq change to mean scala.collection.immutable.Seq?

We have plans to change the scala.Seq alias, https://github.com/scala/collection-strawman/issues/149.

Historical discussion: https://groups.google.com/forum/#!topic/scala-internals/g_-gIWgB8Os

Collection Implementers

CanBuildFrom no longer exists - what were its uses and how can they be replaced?

How can I write generic extension methods?

How do I integrate my collection in the new design?

Read the draft document on the design of the Scala 2.13 collections: https://github.com/scalacenter/docs.scala-lang/blob/collection-strawman/_overviews/core/architecture-of-scala-collections.md

How can I cross-build my collection implementation against 2.12 and 2.13?

Examples

Clone this wiki locally