GithubHelp home page GithubHelp logo

scala / scala-collection-compat Goto Github PK

View Code? Open in Web Editor NEW
202.0 18.0 85.0 1.05 MB

makes some Scala 2.13 APIs (primarily collections, also some others) available on 2.11 and 2.12, to aid cross-building

License: Apache License 2.0

Scala 98.42% Shell 0.19% Java 1.39%

scala-collection-compat's Introduction

scala-collection-compat Scala version support

Purpose and scope

This library makes some Scala 2.13 APIs available on Scala 2.11 and 2.12.

The idea is to facilitate cross-building Scala 2.13 and 3.0 code on the older versions.

Although the name of the library is scala-"collection"-compat, we have now widened the scope to include other parts of the Scala 2.13/3.0 standard library besides just collections.

Only the most commonly used APIs are supported; many are missing. Contributions are welcome.

Usage

To use this library, add the following to your build.sbt:

libraryDependencies += "org.scala-lang.modules" %% "scala-collection-compat" % "<version>"

All future versions will remain backwards binary compatible with 2.0.0. (The 1.0.0 release was withdrawn and should not be used.)

How it works

The 2.13 and 3.0 versions consist only of an empty scala.collection.compat package object, so import scala.collection.compat._ won't cause an error in cross-compiled code.

The 2.11 and 2.12 versions have the needed compatibility code in this package.

Changed methods

The 2.13 collections redesign did not break source compatibility for most ordinary code, but there are some exceptions.

For example, the to method is used with a type parameter in 2.12:

xs.to[List]

With this compatibility library you can instead use the 2.13 syntax, which takes a value parameter:

import scala.collection.compat._
xs.to(List)

New collections

The library also adds backported versions of new collection types, such as immutable.ArraySeq and immutable.LazyList. (On 2.13, these types are just aliases to standard library types.)

New collection methods

Support is included for some 2.13 collections methods such as maxOption.

Other new classes

Support is included for some non-collections classes, such as:

  • @nowarn annotation, added in 2.13.2 and 2.12.13. (The 2.11 @nowarn doesn't do anything, but its presence facilitates cross-compilation.)

Other new methods

Support is included for some other methods, such as:

  • toIntOption (and Long, et al) on String

Migration rules

The migration rules use scalafix. Please see the official installation instructions if you are using an old version of sbt (<1.3) or in case the commands below do not work.

// project/plugins.sbt
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.10.1")

Collection213Upgrade

The Collection213Upgrade rewrite upgrades to the 2.13 collections without the ability to compile the code-base with 2.12 or 2.11. This rewrite is suitable for applications that don't need to cross-compile against multiple Scala versions.

// build.sbt
scalacOptions += "-P:semanticdb:synthetics:on"
// sbt shell
> scalafixEnable
> scalafixAll dependency:[email protected]:scala-collection-migrations:<version>

Collection213CrossCompat

The Collection213CrossCompat rewrite upgrades to the 2.13 collections with the ability to compile the code-base with 2.12 or later. This rewrite is suitable for libraries that are cross-published for multiple Scala versions.

To cross-build for 2.12 and 2.11, the rewrite rule introduces a dependency on the scala-collection-compat module, which provides some APIs of 2.13 on 2.12 and 2.11. This enables you to write your library using the latest 2.13 collections API while still supporting users on an older Scala version.

// build.sbt
libraryDependencies +=  "org.scala-lang.modules" %% "scala-collection-compat" % "<version>"
scalacOptions += "-P:semanticdb:synthetics:on"
// sbt shell
> scalafixEnable
> scalafixAll dependency:[email protected]:scala-collection-migrations:<version>

Fixing unused import warnings

In Scala 2.13 the import scala.collection.compat._ sometimes is not needed (e.g. .to(SeqType) is natively available). This leads to a unused import warning under Scala 2.13 even though the import is required for Scala 2.12. In order to work around this, you can pass a compiler option to ignore this specific issue, e.g. in SBT:

scalacOptions += "-Wconf:origin=scala.collection.compat.*:s"

Contributing

The migration tool is not exhaustive. Contributions of additional rewrites are welcome. If you encounter a use case that’s not supported, please report it as described in the contributing documentation.

scala-collection-compat's People

Contributors

bjaglin avatar diebauer avatar dwijnand avatar eed3si9n avatar ekrich avatar emanb29 avatar griggt avatar haukeh avatar ijuma avatar jd557 avatar julienrf avatar kwalcock avatar lrytz avatar marcelocenerine avatar masseguillaume avatar nthportal avatar olafurpg avatar pedorich-n avatar pietrotull avatar raboof avatar rjolly avatar robstoll avatar rtyley avatar rustedbones avatar scala-steward avatar sethtisue avatar smarter avatar szeiger avatar xerial avatar xuwei-k avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

scala-collection-compat's Issues

Missing *ToCBF

The following gives compilations errors in 2.12:

type mismatch;
[error]  found   : scala.collection.mutable.TreeMap.type
[error]  required: scala.collection.generic.CanBuildFrom[Nothing,Int,?]
import scala.collection.compat._

{
  import scala.collection.immutable._
  List(1).to(::)
  List(1).to(HashMap)
  List(1).to(IntMap)
  List(1).to(ListMap)
  List(1).to(LongMap)
  List(1).to(Map)
  List(1).to(Nil)
  List(1).to(NumericRange)
  List(1).to(PagedSeq)
  List(1).to(Range)
  List(1).to(SortedMap)
  List(1).to(StringLike)
  List(1).to(StringOps)
  List(1).to(TreeMap)
  List(1).to(WrappedString)
}

{
  import scala.collection.mutable._
  List(1).to(AnyRefMap)
  List(1).to(ArrayBuilder)
  List(1).to(ArrayOps)
  List(1).to(ObservableBuffer)
  List(1).to(PriorityQueue)
  List(1).to(UnrolledBuffer)
  List(1).to(WrappedArray)
  List(1).to(HashMap)
  List(1).to(History)
  List(1).to(IndexedSeqView)
  List(1).to(LinkedHashMap)
  List(1).to(ListMap)
  List(1).to(LongMap)
  List(1).to(Map)
  List(1).to(MultiMap)
  List(1).to(OpenHashMap)
  List(1).to(SortedMap)
  List(1).to(TreeMap)
  List(1).to(WeakHashMap)
}

I think IntMap could be implemented like this:

implicit def intMapCompanionCBF[A](fact: i.IntMap.type): CanBuildFrom[Any, (Int, A), i.IntMap[A]] =
  simpleCBF(i.IntMap.canBuildFrom[Any, A]())

Scala.js and native support

Lots of our most depended on libraries (e.g. scalacheck) support Scala.js or Scala native. We should support these runtimes.

Rewrite for eta-expension

One of the probably many paterns to rewrite (see scala/scala#6475 for more details):

class C(in: () => Int)
def f(): Int = 1

new C(f) // does not compile anymore in 2.13.0-M4
-new C(f)
+new C(() => f)

Iterator#sameElements has a different signature between 2.12 and 2.13

iterable.sameElements(iterable) compiles in 2.12, but in 2.13 the recommended way to write this is to use iterable.iterator.sameElements(iterable). However, that form does not cross-compile with 2.12, because sameElements take an Iterator in 2.12, whereas it takes an IterableOnce in 2.13. We can produce 2.12-compatible code by producing iterable.iterator.sameElements(iterable.iterator) instead.

Add groupMap and groupMapReduce

So that users can migrate the following pattern:

iterable.groupBy(f).mapValues(g).toMap

Into just:

iterable.groupMap(f)(g)

Add `SortedSet.unsorted` and `SortedMap.unsorted`

SortedSet.map in 2.12 returns a Set if it cannot find an implicit Ordering. To keep this behavior in 2.13, you can use unsorted. However, this method is not available in 2.12.

case class A(v: Int)
val set = collection.immutable.SortedSet(1)
set.map(x => A(x))
// Set(A(1)): Set[A] in 2.12
// error: No implicit Ordering defined for A. in 2.13

rewrite rule CanBuildFrom -> Factory / BuildFrom

Rewrite rule .to[X] => .to(X) is not cross-compatible for Map

Currently, the rewrite will do the following patch

-List((1, 2)).to[Map]: Map[Int, Int]
+List((1, 2)).to(Map): Map[Int, Int]

This gives a type error since the to function returns an Iterable[(Int, Int)].

The signature of .to[X] is

def to[Col[_]](implicit cbf: CanBuildFrom[Nothing, A, Col[A @uV]]): Col[A @uV]

https://github.com/scala/scala/blob/90c94cc2ead0b7b1d9ba170da08d27504b2f0fa8/src/library/scala/collection/GenTraversableOnce.scala#L668

Because of the Col[A] it's not possible to use to in order to create a Map[Int, Int]. We should guard for similar types: BitSet, SortedMap, etc and convert to the expected type.

-List((1, 2)).to[Map]: Map[Int, Int]
+List((1, 2)).to(Map).toMap: Map[Int, Int]

Rewrite rules for @deprecated since 2.12.x

Deprecated methods in 2.12, removed in 2.13:

[ ] scala.concurrent

  Future

    @deprecated("use `foreach` or `onComplete` instead (keep in mind that they take total rather than partial functions)", "2.12.0")
    def onSuccess[U](pf: PartialFunction[T, U])(implicit executor: ExecutionContext): Unit

    @deprecated("use `onComplete` or `failed.foreach` instead (keep in mind that they take total rather than partial functions)", "2.12.0")
    def onFailure[U](@deprecatedName('callback) pf: PartialFunction[Throwable, U])(implicit executor: ExecutionContext): Unit

    @deprecated("use the overloaded version of this method that takes a scala.collection.immutable.Iterable instead", "2.12.0")
    def find[T](@deprecatedName('futurestravonce) futures: TraversableOnce[Future[T]])(@deprecatedName('predicate) p: T => Boolean)(implicit executor: ExecutionContext): Future[Option[T]] 

    @deprecated("use Future.reduceLeft instead", "2.12.0")
    def reduce[T, R >: T](futures: TraversableOnce[Future[T]])(op: (R, T) => R)(implicit executor: ExecutionContext): Future[R] = {

Improve user documentation

  • Inline sbt-scalafix installation instructions
  • Mention all the important details to pay attention to (like the Scala version of the project to migrate)
  • List the different rules and explain their differences and use cases

Rewrite VarArg application taking `scala.collection.Seq`

seen in https://github.com/scalikejdbc/scalikejdbc/pull/887/files#diff-0b7a8f44eeac5b6ce7571b09b0bffe98L77

in 2.13

val a: scala.collection.Seq[Any] = Seq()
def f(x: Any*): Unit = ()
f(a: _*)

type mismatch;
[error]  found   : Seq[Any] (in scala.collection) 
[error]  required: Seq[Any] (in scala.collection.immutable) 
[error]   f(a: _*)
[error]     ^

compiles in 2.12 and 2.13:

val a: scala.collection.Seq[Any] = Seq()
def f(x: Any*): Unit = ()
f(a.toSeq: _*)

summary:

input:

f(a: _*)

output:

f(a.toSeq: _*)

Rewrite CanBuildFrom => Factory from a class

https://github.com/akka/akka/blob/131e6d10d63fb4aa293d9eb54b58d4f74f5ddee9/akka-stream/src/main/scala/akka/stream/impl/Sinks.scala#L268-L309

@InternalApi private[akka] final class SeqStage[T, That](implicit cbf: CanBuildFrom[Nothing, T, That with immutable.Traversable[_]]) extends GraphStageWithMaterializedValue[SinkShape[T], Future[That]] {
  val in = Inlet[T]("seq.in")

  override def toString: String = "SeqStage"

  override val shape: SinkShape[T] = SinkShape.of(in)

  override protected def initialAttributes: Attributes = DefaultAttributes.seqSink

  override def createLogicAndMaterializedValue(inheritedAttributes: Attributes) = {
    val p: Promise[That] = Promise()
    val logic = new GraphStageLogic(shape) with InHandler {
      val buf = cbf()

      override def preStart(): Unit = pull(in)

      def onPush(): Unit = {
        buf += grab(in)
        pull(in)
      }

      override def onUpstreamFinish(): Unit = {
        val result = buf.result()
        p.trySuccess(result)
        completeStage()
      }

      override def onUpstreamFailure(ex: Throwable): Unit = {
        p.tryFailure(ex)
        failStage(ex)
      }

      override def postStop(): Unit = {
        if (!p.isCompleted) p.failure(new AbruptStageTerminationException(this))
      }

      setHandler(in, this)
    }

    (logic, p.future)
  }
}

https://github.com/akka/akka/blob/131e6d10d63fb4aa293d9eb54b58d4f74f5ddee9/akka-stream/src/main/scala/akka/stream/scaladsl/Sink.scala#L236-L248

  def collection[T, That](implicit cbf: CanBuildFrom[Nothing, T, That with immutable.Traversable[_]]): Sink[T, Future[That]] =
    Sink.fromGraph(new SeqStage[T, That])

expected:

@InternalApi private[akka] final class SeqStage[T, That](implicit cbf: Factory[T, That with immutable.Traversable[_]]) extends GraphStageWithMaterializedValue[SinkShape[T], Future[That]] {
@InternalApi private[akka] final class SeqStage[T, That](implicit cbf: Factory[T, That with immutable.Traversable[_]]) extends GraphStageWithMaterializedValue[SinkShape[T], Future[That]] {
  val in = Inlet[T]("seq.in")

  override def toString: String = "SeqStage"

  override val shape: SinkShape[T] = SinkShape.of(in)

  override protected def initialAttributes: Attributes = DefaultAttributes.seqSink

  override def createLogicAndMaterializedValue(inheritedAttributes: Attributes) = {
    val p: Promise[That] = Promise()
    val logic = new GraphStageLogic(shape) with InHandler {
      val buf = cbf.newBuilder

      override def preStart(): Unit = pull(in)

      def onPush(): Unit = {
        buf += grab(in)
        pull(in)
      }

      override def onUpstreamFinish(): Unit = {
        val result = buf.result()
        p.trySuccess(result)
        completeStage()
      }

      override def onUpstreamFailure(ex: Throwable): Unit = {
        p.tryFailure(ex)
        failStage(ex)
      }

      override def postStop(): Unit = {
        if (!p.isCompleted) p.failure(new AbruptStageTerminationException(this))
      }

      setHandler(in, this)
    }

    (logic, p.future)
  }
}

scala-collection-compat is not available

  1. There is no new version published, the last one is (v0.1.1) is 100 commits ago

  2. Since we split the migration in multiple files, it's not possible to distribute migration rules via the only distribution mechanism in scalafix 0.5.10 (via GitHub). I forked 0.5.10 to add the sbt plugin settings scalafixDepedencies. This should be available in scalafix 0.6.0 (https://github.com/scalacenter/sbt-scalafix/issues/7) (ETA: August 20th).

This is what I do to use scala-collection-compat on akka:

# Build 0.2.0-SNAPSHOT
git clone https://github.com/scala/scala-collection-compat
pushd scala-collection-compat
sbt publishLocal
popd

# Build 0.5.10-1-aed3e830
git clone [email protected]:MasseGuillaume/scalafix.git
pushd
sbt publishLocal
popd

Then you can use it like this:

project/plugins.sbt

addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.5.10-1-aed3e830")

build.sbt

import scalafix.sbt.ScalafixPlugin.autoImport.scalafixDepedencies
lazy val scalaCollectionCompatVersion = "0.2.0-SNAPSHOT"
scalacOptions += "-Yrangepos"
scalafixDepedencies += "org.scala-lang.modules" % "scala-collection-migrations" % scalaCollectionCompatVersion
libraryDependencies += "org.scala-lang.modules" %% "scala-collection-compat" % collectionCompatVersion

Scala 2.11 support?

should we support Scala 2.11 here? (would it be hard?)

in the library ecosystem, I think a lot of libraries will be cross-building to 2.11 for a long while yet

Add `CrossCompat` migration rule that produces code which cross-compiles with 2.12-

The NewCollections migration rule produces code that only compiles with Scala 2.13.0. This is fine for applications, but libraries usually cross compile to several Scala versions.

We should add another migration rule (e.g. CrossCompat), which would produce code that happily cross-compiles with all the Scala versions supported by the scala-collection-compat module.

Compared to the NewCollections rule, the CrossCompat rule should:

  • apply a subset of the rewrites that produces code compiling with 2.12-, or code supported by the compat library,
  • add an import to scala.collection.compat._ when necessary.

No implicit for Factory[Nothing, Seq[Nothing]]

2.12

implicitly[CanBuildFrom[Nothing, Nothing, Seq[Nothing]]]

2.13

implicitly[Factory[Nothing, Seq[Nothing]]]

2.12 + compat

import scala.collection.compat._
implicitly[Factory[Nothing, Seq[Nothing]]]
// could not find implicit value for parameter e: collection.compat.Factory[Nothing,Seq[Nothing]]

Use case:
https://github.com/akka/akka/blob/a0e79a0542dc0fc98bf8431a1cfd1a454f45b282/akka-stream-tests/src/test/scala/akka/stream/scaladsl/CollectionSinkSpec.scala#L39

Rewrite rules for @deprecated since 2.13.x

methods deprecated as of 2.13.0

[ ] scala.collection.generic

  @deprecated("Clearable was moved from collection.generic to collection.mutable", "2.13.0")
  [X] type Clearable = scala.collection.mutable.Clearable

  @deprecated("Use scala.collection.BuildFrom instead", "2.13.0")
  [ ] type CanBuildFrom[-From, -A, +C] = scala.collection.BuildFrom[From, A, C]

[ ] scala.collection

  @deprecated("Use Iterable instead of Traversable", "2.13.0")
  [X] type Traversable[+X] = Iterable[X]

  @deprecated("Use Iterable instead of Traversable", "2.13.0")
  [X] val Traversable = Iterable

  @deprecated("Use IterableOnce instead of TraversableOnce", "2.13.0")
  [X] type TraversableOnce[+X] = IterableOnce[X]

  @deprecated("Use IterableOnce instead of TraversableOnce", "2.13.0")
  [X] val TraversableOnce = IterableOnce

  @deprecated("Use SeqOps instead of SeqLike", "2.13.0")
  [ ] type SeqLike[A, T] = SeqOps[A, Seq, T]

  @deprecated("Use SeqOps (for the methods) or IndexedSeqOps (for fast indexed access) instead of ArrayLike", "2.13.0")
  [ ] type ArrayLike[A] = SeqOps[A, Seq, Seq[A]]

  @deprecated("Gen* collection types have been removed", "2.13.0")
  [ ] type GenTraversableOnce[+X] = IterableOnce[X]

  @deprecated("Gen* collection types have been removed", "2.13.0")
  [ ] val GenTraversableOnce = IterableOnce

  @deprecated("Gen* collection types have been removed", "2.13.0")
  [ ] type GenTraversable[+X] = Iterable[X]

  @deprecated("Gen* collection types have been removed", "2.13.0")
  [ ] val GenTraversable = Iterable

  @deprecated("Gen* collection types have been removed", "2.13.0")
  [ ] type GenIterable[+X] = Iterable[X]

  @deprecated("Gen* collection types have been removed", "2.13.0")
  [ ] val GenIterable = Iterable

  @deprecated("Gen* collection types have been removed", "2.13.0")
  [ ] type GenSeq[+X] = Seq[X]

  @deprecated("Gen* collection types have been removed", "2.13.0")
  [ ] val GenSeq = Seq

  @deprecated("Gen* collection types have been removed", "2.13.0")
  [ ] type GenSet[X] = Set[X]

  @deprecated("Gen* collection types have been removed", "2.13.0")
  [ ] val GenSet = Set

  @deprecated("Gen* collection types have been removed", "2.13.0")
  [ ] type GenMap[K, +V] = Map[K, V]

  @deprecated("Gen* collection types have been removed", "2.13.0")
  [ ] val GenMap = Map

  [ ] @deprecated("DefaultMap is no longer necessary; extend Map directly", "2.13.0")
  [ ] trait DefaultMap[K, +V] extends Map[K, V]

  [ ] Searching

    [ ] @deprecated("Search methods are defined directly on SeqOps and do not require scala.collection.Searching any more", "2.13.0")
    [ ] class SearchImpl[Repr, A](private val coll: SeqOps[A, AnyConstr, _]) extends AnyVal

    [ ] @deprecated("Search methods are defined directly on SeqOps and do not require scala.collection.Searching any more", "2.13.0")
    [ ] implicit def search[Repr, A](coll: Repr)(implicit fr: IsSeqLike[Repr]): SearchImpl[Repr, fr.A]

  [ ] Seq

    @deprecated("Use `concat` instead", "2.13.0")
    [ ] @inline final def union[B >: A, That](that: Seq[B]): CC[B] = concat(that)

    @deprecated("Use segmentLength instead of prefixLength", "2.13.0")
    [ ] @`inline` final def prefixLength(p: A => Boolean): Int = segmentLength(p, 0)

    @deprecated("Use .reverseIterator.map(f).to(...) instead of .reverseMap(f)", "2.13.0")
    [ ] def reverseMap[B](f: A => B): CC[B] = fromIterable(new View.Map(View.fromIteratorProvider(() => reverseIterator), f))

  [ ] Set

    @deprecated("Use &~ or diff instead of --", "2.13.0")
    [ ] @`inline` final def -- (that: Set[A]): C = diff(that)

    @deprecated("Consider requiring an immutable Set or fall back to Set.diff", "2.13.0")
    [ ] def - (elem: A): C = diff(Set(elem))

    @deprecated("Use &- with an explicit collection argument instead of - with varargs", "2.13.0")
    [ ] def - (elem1: A, elem2: A, elems: A*): C = diff(elems.toSet + elem1 + elem2)

    @deprecated("Consider requiring an immutable Set or fall back to Set.union", "2.13.0")
    [ ] def + (elem: A): C = fromSpecificIterable(new View.Appended(toIterable, elem))

    @deprecated("Use ++ with an explicit collection argument instead of + with varargs", "2.13.0")
    [ ] def + (elem1: A, elem2: A, elems: A*): C = fromSpecificIterable(new View.Concat(new View.Appended(new View.Appended(toIterable, elem1), elem2), elems))

  [ ] SortedMap

    @deprecated("Consider requiring an immutable Map or fall back to Map.concat", "2.13.0")
    [ ] override def + [V1 >: V](kv: (K, V1)): CC[K, V1] = sortedMapFactory.from(new View.Appended(toIterable, kv))

    @deprecated("Use ++ with an explicit collection argument instead of + with varargs", "2.13.0")
    [ ] override def + [V1 >: V](elem1: (K, V1), elem2: (K, V1), elems: (K, V1)*): CC[K, V1] = sortedMapFactory.from(new View.Concat(new View.Appended(new View.Appended(toIterable, elem1), elem2), elems))

  [ ] SortedOps

    @deprecated("Use rangeFrom", "2.13.0")
    [ ] final def from(from: A): C = rangeFrom(from)

    @deprecated("Use rangeUntil", "2.13.0")
    [ ] final def until(until: A): C = rangeUntil(until)

    @deprecated("Use rangeTo", "2.13.0")
    [ ] final def to(to: A): C = rangeTo(to)

  StringOps
    @deprecated("Use `new WrappedString(s).diff(...).self` instead of `s.diff(...)`", "2.13.0")
    [ ] def diff(that: Seq[_ >: Char]): String = new WrappedString(s).diff(that).self

    @deprecated("Use `new WrappedString(s).intersect(...).self` instead of `s.intersect(...)`", "2.13.0")
    [ ] def intersect(that: Seq[_ >: Char]): String = new WrappedString(s).intersect(that).self

    @deprecated("Use `new WrappedString(s).distinct.self` instead of `s.distinct`", "2.13.0")
    [ ] def distinct: String = new WrappedString(s).distinct.self

    @deprecated("Use `new WrappedString(s).distinctBy(...).self` instead of `s.distinctBy(...)`", "2.13.0")
    [ ] def distinctBy[B](f: Char => B): String = new WrappedString(s).distinctBy(f).self

    @deprecated("Use `new WrappedString(s).sorted.self` instead of `s.sorted`", "2.13.0")
    [ ] def sorted[B >: Char](implicit ord: Ordering[B]): String = new WrappedString(s).sorted(ord).self

    @deprecated("Use `new WrappedString(s).sortWith(...).self` instead of `s.sortWith(...)`", "2.13.0")
    [ ] def sortWith(lt: (Char, Char) => Boolean): String = new WrappedString(s).sortWith(lt).self

    @deprecated("Use `new WrappedString(s).sortBy(...).self` instead of `s.sortBy(...)`", "2.13.0")
    [ ] def sortBy[B](f: Char => B)(implicit ord: Ordering[B]): String = new WrappedString(s).sortBy(f)(ord).self

    @deprecated("Use `new WrappedString(s).groupBy(...).mapValues(_.self)` instead of `s.groupBy(...)`", "2.13.0")
    [ ] def groupBy[K](f: Char => K): immutable.Map[K, String] = new WrappedString(s).groupBy(f).mapValues(_.self).toMap

    @deprecated("Use `new WrappedString(s).sliding(...).map(_.self)` instead of `s.sliding(...)`", "2.13.0")
    [ ] def sliding(size: Int, step: Int = 1): Iterator[String] = new WrappedString(s).sliding(size, step).map(_.self)

    @deprecated("Use `new WrappedString(s).combinations(...).map(_.self)` instead of `s.combinations(...)`", "2.13.0")
    [ ] def combinations(n: Int): Iterator[String] = new WrappedString(s).combinations(n).map(_.self)

    @deprecated("Use `new WrappedString(s).permutations(...).map(_.self)` instead of `s.permutations(...)`", "2.13.0")
    [ ] def permutations: Iterator[String] = new WrappedString(s).permutations.map(_.self)

  View

    @deprecated("Views no longer know about their underlying collection type; .force always returns an IndexedSeq", "2.13.0")
    [ ] @`inline` def force: IndexedSeq[A] = toIndexedSeq


  Iterable
    @deprecated("Iterable.seq always returns the iterable itself", "2.13.0")
    [ ] def seq: this.type = this

    [ ] @deprecated("Use .knownSize >=0 instead of .hasDefiniteSize", "2.13.0")
    [ ] @`inline` final def hasDefiniteSize = knownSize >= 0

    @deprecated("Use .view.slice(from, until) instead of .view(from, until)", "2.13.0")
    [ ] @`inline` final def view(from: Int, until: Int): View[A]

  IterableOnce
    @deprecated("Use .iterator.foreach(...) instead of .foreach(...) on IterableOnce", "2.13.0")
    [ ] @`inline` def foreach[U](f: A => U): Unit

    @deprecated("Use factory.from(it) instead of it.to(factory) for IterableOnce", "2.13.0")
    [ ] def to[C1](factory: Factory[A, C1]): C1

    @deprecated("Use ArrayBuffer.from(it) instead of it.toBuffer", "2.13.0")
    [ ] def toBuffer[B >: A]: mutable.Buffer[B]

    @deprecated("Use ArrayBuffer.from(it).toArray", "2.13.0")
    [ ] def toArray[B >: A: ClassTag]: Array[B]

    @deprecated("Use List.from(it) instead of it.toList", "2.13.0")
    [ ] def toList: immutable.List[A] = immutable.List.from(it)

    @deprecated("Use Set.from(it) instead of it.toSet", "2.13.0")
    [ ] @`inline` def toSet[B >: A]: immutable.Set[B] = immutable.Set.from(it)

    @deprecated("Use Iterable.from(it) instead of it.toIterable", "2.13.0")
    [ ] @`inline` final def toIterable: Iterable[A] = Iterable.from(it)

    @deprecated("Use Seq.from(it) instead of it.toSeq", "2.13.0")
    [ ] @`inline` def toSeq: immutable.Seq[A] = immutable.Seq.from(it)

    @deprecated("Use Stream.from(it) instead of it.toStream", "2.13.0")
    [ ] @`inline` def toStream: immutable.Stream[A] = immutable.Stream.from(it)

    @deprecated("Use Vector.from(it) instead of it.toVector on IterableOnce", "2.13.0")
    [ ] @`inline` def toVector: immutable.Vector[A] = immutable.Vector.from(it)

    @deprecated("Use Map.from(it) instead of it.toMap on IterableOnce", "2.13.0")
    [ ] def toMap[K, V](implicit ev: A <:< (K, V)): immutable.Map[K, V]

    @deprecated("toIterator has been renamed to iterator", "2.13.0")
    [ ] @`inline` def toIterator: Iterator[A] = it.iterator

    @deprecated("Use .iterator.isEmpty instead of .isEmpty on IterableOnce", "2.13.0")
    [ ] def isEmpty: Boolean

    @deprecated("Use .iterator.mkString instead of .mkString on IterableOnce", "2.13.0")
    [ ] def mkString(start: String, sep: String, end: String): String

    @deprecated("Use .iterator.mkString instead of .mkString on IterableOnce", "2.13.0")
    [ ] def mkString(sep: String): String

    @deprecated("Use .iterator.mkString instead of .mkString on IterableOnce", "2.13.0")
    [ ] def mkString: String = it match

    @deprecated("Use .iterator.find instead of .find on IterableOnce", "2.13.0")
    [ ] def find(p: A => Boolean): Option[A]

    @deprecated("Use .iterator.foldLeft instead of .foldLeft on IterableOnce", "2.13.0")
    [ ] @`inline` def foldLeft[B](z: B)(op: (B, A) => B): B

    @deprecated("Use .iterator.foldRight instead of .foldLeft on IterableOnce", "2.13.0")
    [ ] @`inline` def foldRight[B](z: B)(op: (A, B) => B): B

    @deprecated("Use .iterator.fold instead of .fold on IterableOnce", "2.13.0")
    [ ] def fold[A1 >: A](z: A1)(op: (A1, A1) => A1): A1

    @deprecated("Use .iterator.foldLeft instead of /: on IterableOnce", "2.13.0")
    [ ] @`inline` def /: [B](z: B)(op: (B, A) => B): B

    @deprecated("Use .iterator.foldRight instead of :\\ on IterableOnce", "2.13.0")
    [ ] @`inline` def :\ [B](z: B)(op: (A, B) => B): B

    @deprecated("Use .iterator.map instead of .map on IterableOnce or consider requiring an Iterable", "2.13.0")
    [ ] def map[B](f: A => B): IterableOnce[B]

    @deprecated("Use .iterator.flatMap instead of .flatMap on IterableOnce or consider requiring an Iterable", "2.13.0")
    [ ] def flatMap[B](f: A => IterableOnce[B]): IterableOnce[B]

    @deprecated("Use .iterator.sameElements for sameElements on Iterable or IterableOnce", "2.13.0")
    [ ] def sameElements[B >: A](that: IterableOnce[B]): Boolean

Map

  @deprecated("Use - or remove on an immutable Map", "2.13.0")
  [ ] def - (key: K): Map[K, V]

  @deprecated("Use -- or removeAll on an immutable Map", "2.13.0")
  [ ] def - (key1: K, key2: K, keys: K*): Map[K, V]

TreeMap

  @deprecated("Use `updated` instead", "2.13.0")
  [ ] def insert[V1 >: V](key: K, value: V1): TreeMap[K, V1]

AnyRefMap

  @deprecated("Consider requiring an immutable Map or fall back to Map.concat", "2.13.0")
  [ ] override def + [V1 >: V](kv: (K, V1)): AnyRefMap[K, V1] = AnyRefMap.from(new View.Appended(toIterable, kv))

  @deprecated("Use ++ with an explicit collection argument instead of + with varargs", "2.13.0")
  [ ] override def + [V1 >: V](elem1: (K, V1), elem2: (K, V1), elems: (K, V1)*): AnyRefMap[K, V1] = AnyRefMap.from(new View.Concat(new View.Appended(new View.Appended(toIterable, elem1), elem2), elems))

  @deprecated("Use AnyRefMap.from(m).add(k,v) instead of m.updated(k, v)", "2.13.0")
  [ ] def updated[V1 >: V](key: K, value: V1): AnyRefMap[K, V1] = {

mutable
  @deprecated("Use ArraySeq instead of WrappedArray; it can represent both, boxed and unboxed arrays", "2.13.0")
  [ ] type WrappedArray[X] = ArraySeq[X]
  
  @deprecated("Use ArraySeq instead of WrappedArray; it can represent both, boxed and unboxed arrays", "2.13.0")
  [ ] val WrappedArray = ArraySeq
  
  @deprecated("Use Iterable instead of Traversable", "2.13.0")
  [ ] type Traversable[X] = Iterable[X]
  
  @deprecated("Use Iterable instead of Traversable", "2.13.0")
  [ ] val Traversable = Iterable
  
  @deprecated("Use Stack instead of ArrayStack; it now uses an array-based implementation", "2.13.0")
  [ ] type ArrayStack[X] = Stack[X]
  
  @deprecated("Use Stack instead of ArrayStack; it now uses an array-based implementation", "2.13.0")
  [ ] val ArrayStack = Stack

  @deprecated("mutable.LinearSeq has been removed; use LinearSeq with mutable.Seq instead", "2.13.0")
  [ ] type LinearSeq[X] = Seq[X] with scala.collection.LinearSeq[X]

  @deprecated("GrowingBuilder has been renamed to GrowableBuilder", "2.13.0")
  [ ] type GrowingBuilder[Elem, To <: Growable[Elem]] = GrowableBuilder[Elem, To]

  @deprecated("Use an immutable.ListMap assigned to a var instead of mutable.ListMap", "2.13.0")
  [ ] class ListMap[K, V]

  @deprecated("Use HashMap or one of the specialized versions (LongMap, AnyRefMap) instead of OpenHashMap", "2.13.0")
  [ ] object OpenHashMap

  [ ] Buffer

    @deprecated("Use .addOne or += instead of .append", "2.13.0")
    [ ] @`inline` final def append(elem: A): this.type = addOne(elem)

  [ ] Builder

    @deprecated("Use reverseInPlace instead", "2.13.0")
    [ ] final def reverseContents(): this.type = reverseInPlace()

  [ ] StringBuilder
    @deprecated("Use `new StringBuilder()` instead of `StringBuilder.newBuilder`", "2.13.0")
    [ ] def newBuilder = new StringBuilder

  [ ] IterableOps
    @deprecated("Use `mapInPlace` instead", "2.13.0")
    [ ] @`inline`final def transform(f: A => A): this.type = mapInPlace(f)

    @deprecated("Use xs ++ ys instead of ys ++: xs for xs of type Iterable", "2.13.0")
    [ ] def ++:[B >: A](that: IterableOnce[B]): IterableCC[B] =

  [ ] LongMap
    @deprecated("Consider requiring an immutable Map or fall back to Map.concat", "2.13.0")
    [ ] override def +[V1 >: V](kv: (Long, V1)): LongMap[V1] = {

    @deprecated("Use ++ with an explicit collection argument instead of + with varargs", "2.13.0")
    [ ] override def + [V1 >: V](elem1: (Long, V1), elem2: (Long, V1), elems: (Long, V1)*): LongMap[V1]

    @deprecated("Use LongMap.from(m).add(k,v) instead of m.updated(k, v)", "2.13.0")
    [ ] def updated[V1 >: V](key: Long, value: V1): LongMap[V1] = {


  [ ] Map

    @deprecated("Use - or remove on an immutable Map", "2.13.0")
    [ ] def - (key: K): C = clone() -= key

    @deprecated("Use -- or removeAll on an immutable Map", "2.13.0")
    [ ] def - (key1: K, key2: K, keys: K*): C = clone() -= key1 -= key2 --= keys

    @deprecated("Use .filterInPlace instead of .retain", "2.13.0")
    [X] def retain(p: (K, V) => Boolean): this.type = filterInPlace(p.tupled)

  [X] Set

    @deprecated("Use .filterInPlace instead of .retain", "2.13.0")
    [X] @`inline` final def retain(p: A => Boolean): this.type = filterInPlace(p)
  


[ ] scala.concurrent

  Future
    @deprecated("use Future.foldLeft instead", "2.12.0")
    [ ] def fold[T, R](futures: IterableOnce[Future[T]])(zero: R)(@deprecatedName('foldFun) op: (R, T) => R)(implicit executor: ExecutionContext): Future[R]

    @deprecated("use Future.reduceLeft instead", "2.12.0")
    [ ] def reduce[T, R >: T](futures: IterableOnce[Future[T]])(op: (R, T) => R)(implicit executor: ExecutionContext): Future[R] = {


[ ] scala.math

  @deprecated("This is an integer type; there is no reason to round it. Perhaps you meant to call this with a floating-point value?", "2.11.0")
  [ ] def round(x: Long): Long = x

  Ordering
    @deprecated("There are multiple ways to order Floats (Ordering.Float.TotalOrdering, " +
    "Ordering.Float.IeeeOrdering). Specify one by using a local import, assigning an implicit val, or passing it " +
    "explicitly. See the documentation for details.", since = "2.13.0")
    [ ] implicit object DeprecatedFloatOrdering extends Float.TotalOrdering

    @deprecated("There are multiple ways to order Doubles (Ordering.Double.TotalOrdering, " +
    "Ordering.Double.IeeeOrdering). Specify one by using a local import, assigning an implicit val, or passing it " +
    "explicitly. See the documentation for details.", since = "2.13.0")
    [ ] implicit object DeprecatedDoubleOrdering extends Double.TotalOrdering

[ ] scala.runtime

  [ ] RichInt
    @deprecated("this is an integer type; there is no reason to round it.  Perhaps you meant to call this on a floating-point value?", "2.11.0")
    [ ] def round: Int = self

  [ ] RichLong
    @deprecated("this is an integer type; there is no reason to round it.  Perhaps you meant to call this on a floating-point value?", "2.11.0")
    [ ] def round: Long = self

[ ] scala.sys.process

  [ ] ProcessBuilder

    @deprecated("use lazyLines", since = "2.13.0")
    [ ] def lineStream: Stream[String]

    @deprecated("use lazyLines", since = "2.13.0")
    [ ] def lineStream(capacity: Integer): Stream[String]

    @deprecated("use lazyLines", since = "2.13.0")
    [ ] def lineStream(log: ProcessLogger): Stream[String]

    @deprecated("use lazyLines", since = "2.13.0")
    [ ] def lineStream(log: ProcessLogger, capacity: Integer): Stream[String]

    @deprecated("use lazyLines_!", since = "2.13.0")
    [ ] def lineStream_! : Stream[String]

    @deprecated("use lazyLines_!", since = "2.13.0")
    [ ] def lineStream_!(capacity: Integer): Stream[String]

    @deprecated("use lazyLines_!", since = "2.13.0")
    [ ] def lineStream_!(log: ProcessLogger): Stream[String]

    @deprecated("use lazyLines_!", since = "2.13.0")
    [ ] def lineStream_!(log: ProcessLogger, capacity: Integer): Stream[String]


[ ] Predef

  @deprecated("Implicit conversions from Array to immutable.IndexedSeq are implemented by copying; Use the more efficient non-copying ArraySeq.unsafeWrapArray or an explicit toIndexedSeq call", "2.13.0")
  [ ] implicit def copyArrayToImmutableIndexedSeq[T](xs: Array[T]): IndexedSeq[T]

[X] Byte
  @deprecated("Adding a number and a String is deprecated. Convert the number to a String with `toString` first to call +", "2.13.0")
  [X] def +(x: String): String

  @deprecated("shifting a value by a `Long` argument is deprecated (except when the value is a `Long`).\nCall `toInt` on the argument to maintain the current behavior and avoid the deprecation warning.", "2.12.7")
  [X] def <<(x: Long): Int

  @deprecated("shifting a value by a `Long` argument is deprecated (except when the value is a `Long`).\nCall `toInt` on the argument to maintain the current behavior and avoid the deprecation warning.", "2.12.7")
  [X] def >>>(x: Long): Int

  @deprecated("shifting a value by a `Long` argument is deprecated (except when the value is a `Long`).\nCall `toInt` on the argument to maintain the current behavior and avoid the deprecation warning.", "2.12.7")
  [X] def >>(x: Long): Int

[X] Char

  @deprecated("Adding a number and a String is deprecated. Convert the number to a String with `toString` first to call +", "2.13.0")
  [X] def +(x: String): String

  @deprecated("shifting a value by a `Long` argument is deprecated (except when the value is a `Long`).\nCall `toInt` on the argument to maintain the current behavior and avoid the deprecation warning.", "2.12.7")
  [X] def <<(x: Long): Int

  @deprecated("shifting a value by a `Long` argument is deprecated (except when the value is a `Long`).\nCall `toInt` on the argument to maintain the current behavior and avoid the deprecation warning.", "2.12.7")
  [X] def >>>(x: Long): Int

  @deprecated("shifting a value by a `Long` argument is deprecated (except when the value is a `Long`).\nCall `toInt` on the argument to maintain the current behavior and avoid the deprecation warning.", "2.12.7")
  [X] def >>(x: Long): Int

[X] Int
  @deprecated("Adding a number and a String is deprecated. Convert the number to a String with `toString` first to call +", "2.13.0")
  [X] def +(x: String): String

  @deprecated("shifting a value by a `Long` argument is deprecated (except when the value is a `Long`).\nCall `toInt` on the argument to maintain the current behavior and avoid the deprecation warning.", "2.12.7")
  [X] def <<(x: Long): Int

  @deprecated("shifting a value by a `Long` argument is deprecated (except when the value is a `Long`).\nCall `toInt` on the argument to maintain the current behavior and avoid the deprecation warning.", "2.12.7")
  [X] def >>>(x: Long): Int

  @deprecated("shifting a value by a `Long` argument is deprecated (except when the value is a `Long`).\nCall `toInt` on the argument to maintain the current behavior and avoid the deprecation warning.", "2.12.7")
  [X] def >>(x: Long): Int
  
[X] Short

  @deprecated("Adding a number and a String is deprecated. Convert the number to a String with `toString` first to call +", "2.13.0")
  [X] def +(x: String): String

  @deprecated("shifting a value by a `Long` argument is deprecated (except when the value is a `Long`).\nCall `toInt` on the argument to maintain the current behavior and avoid the deprecation warning.", "2.12.7")
  [X] def <<(x: Long): Int

  @deprecated("shifting a value by a `Long` argument is deprecated (except when the value is a `Long`).\nCall `toInt` on the argument to maintain the current behavior and avoid the deprecation warning.", "2.12.7")
  [X] def >>>(x: Long): Int

  @deprecated("shifting a value by a `Long` argument is deprecated (except when the value is a `Long`).\nCall `toInt` on the argument to maintain the current behavior and avoid the deprecation warning.", "2.12.7")
  [X] def >>(x: Long): Int

[X] Double

  @deprecated("Adding a number and a String is deprecated. Convert the number to a String with `toString` first to call +", "2.13.0")
  [X] def +(x: String): String

[X] Float

  @deprecated("Adding a number and a String is deprecated. Convert the number to a String with `toString` first to call +", "2.13.0")
  [X] def +(x: String): String

[X] Long

  @deprecated("Adding a number and a String is deprecated. Convert the number to a String with `toString` first to call +", "2.13.0")
  [X] def +(x: String): String


[X] Function

  // @deprecated("use `f.tupled` instead")
  [X] def tupled[a1, a2, b](f: (a1, a2) => b): Tuple2[a1, a2] => b
  [X] def tupled[a1, a2, a3, b](f: (a1, a2, a3) => b): Tuple3[a1, a2, a3] => b
  [X] def tupled[a1, a2, a3, a4, b](f: (a1, a2, a3, a4) => b): Tuple4[a1, a2, a3, a4] => b
  [X] def tupled[a1, a2, a3, a4, a5, b](f: (a1, a2, a3, a4, a5) => b): Tuple5[a1, a2, a3, a4, a5] => b

[X] scala
  @deprecated("Use IterableOnce instead of TraversableOnce", "2.13.0")
  [X] type TraversableOnce[+A] = scala.collection.IterableOnce[A]

  @deprecated("Use Iterable instead of Traversable", "2.13.0")
  [X] type Traversable[+A] = scala.collection.Iterable[A]

  @deprecated("Use Iterable instead of Traversable", "2.13.0")
  [X] val Traversable = scala.collection.Iterable

  @deprecated("Use scala.collection.BufferedIterator instead of scala.BufferedIterator", "2.13.0")
  [X] type BufferedIterator[+A] = scala.collection.BufferedIterator[A]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.