You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would prefer it returns the most specific collection since this method is needed for compatibility with < 2.13. In < 2.13 map, collect and flatMap returns the most specific unsorted type of the collection when it cannot find an implicit Ordering:
caseclassA(v: Int)
valset= collection.immutable.SortedSet(1)
set.map(x =>A(x))
// Set(A(1)): collection.immutable.Set[A] in 2.12// error: No implicit Ordering defined for A. in 2.13
In order to cross-compile between 2.12 and 2.13 we could write the following:
https://static.javadoc.io/org.scala-lang/scala-library/2.13.0-M4/index.html?search=unsorted
Currently
unsorted
return the base collection:I would prefer it returns the most specific collection since this method is needed for compatibility with < 2.13. In < 2.13
map
,collect
andflatMap
returns the most specific unsorted type of the collection when it cannot find an implicit Ordering:In order to cross-compile between 2.12 and 2.13 we could write the following:
For 2.12, we add an extension method
unsorted
.Related: scala/scala-collection-compat#95
The text was updated successfully, but these errors were encountered: