Prototype improvements for Scala collections.
The strawman is available as a regular external library (see below usage
instructions). The collections live in the strawman.collection
namespace
(instead of scala.collection
).
Almost all operations and collection types of the current standard collections are available. If you see something missing, please create an issue.
Add the following dependency to your project:
libraryDependencies += "ch.epfl.scala" %% "collection-strawman" % "0.4.0"
The 0.4.0 version is compatible with Scala 2.13 and Dotty 0.2. Scala 2.12 is also supported but you might encounter type inference issues with it.
We also automatically publish snapshots on Sonatype:
resolvers += Resolver.sonatypeRepo("snapshots")
libraryDependencies += "ch.epfl.scala" %% "collection-strawman" % "0.5.0-SNAPSHOT"
A tool is being developed to automatically migrate code that uses the standard collection to use the strawman.
To use it, add the scalafix sbt plugin to your build, as explained in its documentation.
Then run the following sbt task on your project:
> scalafix github:scala/collection-strawman/v0
In essence, the migration tool changes the imports in your source code so that the strawman definitions are imported. It also rewrites expressions that use an API that is different in the strawman.
The migration tool is not exhaustive and we will continue to improve it over time. If you encounter a use case that’s not supported, please report it as described in the contributing documentation.
- September 2017: release targeting Scala 2.13 and Dotty.
- Implement most of the current collections types
- Implement most of the current collections operations
- Alternative to
CanBuildFrom
to get implicit builders - Include tests for correctness (taken from the current collections and from scala-collections-laws)
- Provide a rewriting tool that migrates a code base from the current collections to the strawman
- November 2017: move to the
scala
namespace- Create a branch of Scala 2.13 with the strawman instead of the current collections
- January 2018: new features and performance improvements
- Add Scala.js support
- Consider the inclusion of new collection types (such as
Spandex
,Steque
orArrayDeque
) - Consider the introduction of new operations (such as database-like joins, variants of groupBy, etc.)
- Java interoperability
- Separate project for parallel collections
We welcome contributions!
For more information, see the CONTRIBUTING file.
-
List
-
LazyList
(akaStream
in 2.12) -
Queue
-
Stack
-
ArrayOps
-
StringOps
-
ArrayBuffer
-
ImmutableArray
(new) -
ListBuffer
-
UnrolledBuffer
-
LinkedList
-
DoubleLinkedList
-
Range
/NumericRange
-
Vector
-
HashMap
-
TreeMap
-
IntMap
/LongMap
(?) -
ListMap
-
MultiMap
-
HashSet
-
ListSet
-
TreeSet
-
EqSet
-
BitSet
-
View
-
apply
-
contains
-
containsSlice
-
count
-
endsWith
-
find
-
firstKey
-
forall
/exists
-
foreach
-
foldLeft
-
foldRight
-
get
-
getOrElse
-
getOrElseUpdate
-
head
-
indexOf
/indexWhere
/lastIndexOf
/lastIndexWhere
/indexOfSlice
/lastIndexOfSlice
-
indices
-
isDefinedAt
-
isEmpty
/nonEmpty
-
keysIteratorFrom
-
last
/lastOption
-
lastKey
-
max
/maxBy
-
min
/minBy
-
mkString
-
product
-
reduce
/reduceOption
/reduceLeft
/reduceRight
-
size
-
span
-
startsWith
-
sum
-
to
-
diff
-
distinct
-
drop
/dropRight
/dropWhile
-
empty
-
filter
/filterNot
/filterKeys
-
groupBy
-
init
-
intersect
-
partition
-
range
-
rangeImpl
-
sorted
/sortBy
/sortWith
-
slice
-
splitAt
-
substetOf
-
subsets
-
tail
-
take
/takeRight
/takeWhile
-
updated
-
combinations
-
updated
-
prepend
-
append
-
++
/concat
/union
-
++:
/prependAll
-
flatMap
-
grouped
-
keys
/keySet
/keysIterator
-
map
/mapValues
-
merged
-
padTo
-
permutations
-
scan
/scanLeft
/scanRight
-
sliding
-
unzip
-
values
/valuesIterator
-
zip
/zipWithIndex
TODO