diff options
Diffstat (limited to 'src/library/scala/collection/immutable/List.scala')
-rw-r--r-- | src/library/scala/collection/immutable/List.scala | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/src/library/scala/collection/immutable/List.scala b/src/library/scala/collection/immutable/List.scala index cb67d22fd0..c14e24ab47 100644 --- a/src/library/scala/collection/immutable/List.scala +++ b/src/library/scala/collection/immutable/List.scala @@ -241,10 +241,10 @@ sealed abstract class List[+A] extends LinearSeq[A] /** Like <code>span</code> but with the predicate inverted. */ - @deprecated("use `span { x => !p(x) }` instead") + @deprecated("use `span { x => !p(x) }` instead", "2.8.0") def break(p: A => Boolean): (List[A], List[A]) = span { x => !p(x) } - @deprecated("use `filterNot' instead") + @deprecated("use `filterNot' instead", "2.8.0") def remove(p: A => Boolean): List[A] = filterNot(p) /** Computes the difference between this list and the given list @@ -254,7 +254,7 @@ sealed abstract class List[+A] extends LinearSeq[A] * @return this list without the elements of the given list * `that`. */ - @deprecated("use `list1 filterNot (list2 contains)` instead") + @deprecated("use `list1 filterNot (list2 contains)` instead", "2.8.0") def -- [B >: A](that: List[B]): List[B] = { val b = new ListBuffer[B] var these = this @@ -272,7 +272,7 @@ sealed abstract class List[+A] extends LinearSeq[A] * @return this list without occurrences of the given object * `x`. */ - @deprecated("use `filterNot (_ == x)` instead") + @deprecated("use `filterNot (_ == x)` instead", "2.8.0") def - [B >: A](x: B): List[B] = { val b = new ListBuffer[B] var these = this @@ -283,7 +283,7 @@ sealed abstract class List[+A] extends LinearSeq[A] b.toList } - @deprecated("use `distinct' instead") + @deprecated("use `distinct' instead", "2.8.0") def removeDuplicates: List[A] = distinct /** <p> @@ -302,7 +302,7 @@ sealed abstract class List[+A] extends LinearSeq[A] * .sort((e1, e2) => (e1 compareTo e2) < 0) = * List("Bob", "John", "Steve", "Tom")</pre> */ - @deprecated("use `sortWith' instead") + @deprecated("use `sortWith' instead", "2.8.0") def sort(lt : (A,A) => Boolean): List[A] = { /** Merge two already-sorted lists */ def merge(l1: List[A], l2: List[A]): List[A] = { @@ -456,7 +456,7 @@ object List extends SeqFactory[List] { * or decreasing. * @return the sorted list of all integers in range [start;end). */ - @deprecated("use `iterate' instead") + @deprecated("use `iterate' instead", "2.8.0") def range(start: Int, end: Int, step: Int => Int): List[Int] = { val up = step(start) > start val down = step(start) < start @@ -478,7 +478,7 @@ object List extends SeqFactory[List] { * @param elem the element composing the resulting list * @return a list composed of n elements all equal to elem */ - @deprecated("use `fill' instead") + @deprecated("use `fill' instead", "2.8.0") def make[A](n: Int, elem: A): List[A] = { val b = new ListBuffer[A] var i = 0 @@ -494,7 +494,7 @@ object List extends SeqFactory[List] { * @param xss the list of lists that are to be concatenated * @return the concatenation of all the lists */ - @deprecated("use `xss.flatten' instead of `List.flatten(xss)'") + @deprecated("use `xss.flatten' instead of `List.flatten(xss)'", "2.8.0") def flatten[A](xss: List[List[A]]): List[A] = { val b = new ListBuffer[A] for (xs <- xss) { @@ -512,7 +512,7 @@ object List extends SeqFactory[List] { * @param xs the list of pairs to unzip * @return a pair of lists. */ - @deprecated("use `xs.unzip' instead of `List.unzip(xs)'") + @deprecated("use `xs.unzip' instead of `List.unzip(xs)'", "2.8.0") def unzip[A,B](xs: List[(A,B)]): (List[A], List[B]) = { val b1 = new ListBuffer[A] val b2 = new ListBuffer[B] @@ -530,7 +530,7 @@ object List extends SeqFactory[List] { * @param xs the iterable of pairs to unzip * @return a pair of lists. */ - @deprecated("use `xs.unzip' instead of `List.unzip(xs)'") + @deprecated("use `xs.unzip' instead of `List.unzip(xs)'", "2.8.0") def unzip[A,B](xs: Iterable[(A,B)]): (List[A], List[B]) = xs.foldRight[(List[A], List[B])]((Nil, Nil)) { case ((x, y), (xs, ys)) => (x :: xs, y :: ys) @@ -540,7 +540,7 @@ object List extends SeqFactory[List] { * Returns the `Left` values in the given `Iterable` * of `Either`s. */ - @deprecated("use `xs collect { case Left(x: A) => x }' instead of `List.lefts(xs)'") + @deprecated("use `xs collect { case Left(x: A) => x }' instead of `List.lefts(xs)'", "2.8.0") def lefts[A, B](es: Iterable[Either[A, B]]) = es.foldRight[List[A]](Nil)((e, as) => e match { case Left(a) => a :: as @@ -550,7 +550,7 @@ object List extends SeqFactory[List] { /** * Returns the `Right` values in the given`Iterable` of `Either`s. */ - @deprecated("use `xs collect { case Right(x: B) => x }' instead of `List.rights(xs)'") + @deprecated("use `xs collect { case Right(x: B) => x }' instead of `List.rights(xs)'", "2.8.0") def rights[A, B](es: Iterable[Either[A, B]]) = es.foldRight[List[B]](Nil)((e, bs) => e match { case Left(_) => bs @@ -562,7 +562,7 @@ object List extends SeqFactory[List] { * @param xs the iterable of Eithers to separate * @return a pair of lists. */ - @deprecated("use `(for (Left(x) <- es) yield x, for (Right(x) <- es) yield x)` instead") + @deprecated("use `(for (Left(x) <- es) yield x, for (Right(x) <- es) yield x)` instead", "2.8.0") def separate[A,B](es: Iterable[Either[A, B]]): (List[A], List[B]) = es.foldRight[(List[A], List[B])]((Nil, Nil)) { case (Left(a), (lefts, rights)) => (a :: lefts, rights) @@ -575,7 +575,7 @@ object List extends SeqFactory[List] { * @return a list that contains the elements returned by successive * calls to `it.next` */ - @deprecated("use `it.toList' instead of `List.toList(it)'") + @deprecated("use `it.toList' instead of `List.toList(it)'", "2.8.0") def fromIterator[A](it: Iterator[A]): List[A] = it.toList /** Converts an array into a list. @@ -584,7 +584,7 @@ object List extends SeqFactory[List] { * @return a list that contains the same elements than `arr` * in the same order */ - @deprecated("use `array.toList' instead of `List.fromArray(array)'") + @deprecated("use `array.toList' instead of `List.fromArray(array)'", "2.8.0") def fromArray[A](arr: Array[A]): List[A] = fromArray(arr, 0, arr.length) /** Converts a range of an array into a list. @@ -595,7 +595,7 @@ object List extends SeqFactory[List] { * @return a list that contains the same elements than `arr` * in the same order */ - @deprecated("use `array.view(start, end).toList' instead of `List.fromArray(array, start, end)'") + @deprecated("use `array.view(start, end).toList' instead of `List.fromArray(array, start, end)'", "2.8.0") def fromArray[A](arr: Array[A], start: Int, len: Int): List[A] = { var res: List[A] = Nil var i = start + len @@ -613,7 +613,7 @@ object List extends SeqFactory[List] { * @param separator the separator character * @return the list of substrings */ - @deprecated("use `str.split(separator).toList' instead of `List.fromString(str, separator)'") + @deprecated("use `str.split(separator).toList' instead of `List.fromString(str, separator)'", "2.8.0") def fromString(str: String, separator: Char): List[String] = { var words: List[String] = Nil var pos = str.length() @@ -631,7 +631,7 @@ object List extends SeqFactory[List] { * @param xs the list to convert. * @return the list in form of a string. */ - @deprecated("use `xs.mkString' instead of `List.toString(xs)'") + @deprecated("use `xs.mkString' instead of `List.toString(xs)'", "2.8.0") def toString(xs: List[Char]): String = { val sb = new StringBuilder() var xc = xs @@ -645,7 +645,7 @@ object List extends SeqFactory[List] { /** Like xs map f, but returns `xs` unchanged if function * `f` maps all elements to themselves. */ - @deprecated("use `xs.mapConserve(f)' instead of `List.mapConserve(xs, f)'") + @deprecated("use `xs.mapConserve(f)' instead of `List.mapConserve(xs, f)'", "2.8.0") def mapConserve[A <: AnyRef](xs: List[A])(f: A => A): List[A] = { def loop(ys: List[A]): List[A] = if (ys.isEmpty) xs @@ -679,7 +679,7 @@ object List extends SeqFactory[List] { * `[a0, ..., ak]`, `[b0, ..., bl]` and * `n = min(k,l)` */ - @deprecated("use `(xs, ys).zipped.map(f)' instead of `List.map2(xs, ys)(f)'") + @deprecated("use `(xs, ys).zipped.map(f)' instead of `List.map2(xs, ys)(f)'", "2.8.0") def map2[A,B,C](xs: List[A], ys: List[B])(f: (A, B) => C): List[C] = { val b = new ListBuffer[C] var xc = xs @@ -703,7 +703,7 @@ object List extends SeqFactory[List] { * `[c<sub>0</sub>, ..., c<sub>m</sub>]` and * `n = min(k,l,m)` */ - @deprecated("use `(xs, ys, zs).zipped.map(f)' instead of `List.map3(xs, ys, zs)(f)'") + @deprecated("use `(xs, ys, zs).zipped.map(f)' instead of `List.map3(xs, ys, zs)(f)'", "2.8.0") def map3[A,B,C,D](xs: List[A], ys: List[B], zs: List[C])(f: (A, B, C) => D): List[D] = { val b = new ListBuffer[D] var xc = xs @@ -728,7 +728,7 @@ object List extends SeqFactory[List] { * `[b<sub>0</sub>, ..., b<sub>l</sub>]` * and `n = min(k,l)` */ - @deprecated("use `(xs, ys).zipped.forall(f)' instead of `List.forall2(xs, ys)(f)'") + @deprecated("use `(xs, ys).zipped.forall(f)' instead of `List.forall2(xs, ys)(f)'", "2.8.0") def forall2[A,B](xs: List[A], ys: List[B])(f: (A, B) => Boolean): Boolean = { var xc = xs var yc = ys @@ -750,7 +750,7 @@ object List extends SeqFactory[List] { * `[b<sub>0</sub>, ..., b<sub>l</sub>]` and * `n = min(k,l)` */ - @deprecated("use `(xs, ys).zipped.exists(f)' instead of `List.exists2(xs, ys)(f)'") + @deprecated("use `(xs, ys).zipped.exists(f)' instead of `List.exists2(xs, ys)(f)'", "2.8.0") def exists2[A,B](xs: List[A], ys: List[B])(f: (A, B) => Boolean): Boolean = { var xc = xs var yc = ys @@ -768,7 +768,7 @@ object List extends SeqFactory[List] { * @param xss the list of lists * @return the transposed list of lists */ - @deprecated("use `xss.transpose' instead of `List.transpose(xss)'") + @deprecated("use `xss.transpose' instead of `List.transpose(xss)'", "2.8.0") def transpose[A](xss: List[List[A]]): List[List[A]] = { val buf = new ListBuffer[List[A]] var yss = xss |