diff options
author | Geoffrey Washburn <geoffrey.washburn@epfl.ch> | 2008-05-19 12:50:31 +0000 |
---|---|---|
committer | Geoffrey Washburn <geoffrey.washburn@epfl.ch> | 2008-05-19 12:50:31 +0000 |
commit | 7b33fcff437ff18f31b81a61d45a1fcf8ed75d5c (patch) | |
tree | eea6f44906d27fd2aa74ba8cb1dd64c3b904501a /src/library/scala/collection/immutable/Stack.scala | |
parent | 639ce2f29dfded08e27d5e909b85b653a1567e51 (diff) | |
download | scala-7b33fcff437ff18f31b81a61d45a1fcf8ed75d5c.tar.gz scala-7b33fcff437ff18f31b81a61d45a1fcf8ed75d5c.tar.bz2 scala-7b33fcff437ff18f31b81a61d45a1fcf8ed75d5c.zip |
Deprecate all of the problematic + methods, and...
Deprecate all of the problematic + methods, and removed those that never
appeared in a release.
Diffstat (limited to 'src/library/scala/collection/immutable/Stack.scala')
-rw-r--r-- | src/library/scala/collection/immutable/Stack.scala | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/library/scala/collection/immutable/Stack.scala b/src/library/scala/collection/immutable/Stack.scala index dcff24b51c..dfcb3823df 100644 --- a/src/library/scala/collection/immutable/Stack.scala +++ b/src/library/scala/collection/immutable/Stack.scala @@ -43,10 +43,31 @@ class Stack[+A] extends Seq[A] { /** Push an element on the stack. * + * @deprecated Use the method <code>push</code> from now on. + * * @param elem the element to push on the stack. * @return the stack with the new element on top. */ - override def +[B >: A](elem: B): Stack[B] = new Node(elem) + @deprecated def +[B >: A](elem: B): Stack[B] = new Node(elem) + + /** Push an element on the stack. + * + * @param elem the element to push on the stack. + * @return the stack with the new element on top. + */ + def push[B >: A](elem: B): Stack[B] = new Node(elem) + + /** Push all elements provided by the given iterable object onto + * the stack. The last element returned by the iterable object + * will be on top of the new stack. + * + * @deprecated Use the method <code>push</code> from now on. + * + * @param elems the iterable object. + * @return the stack with the new elements on top. + */ + @deprecated def +[B >: A](elems: Iterable[B]): Stack[B] = + elems.foldLeft(this: Stack[B]){ (stack, elem) => stack + elem } /** Push all elements provided by the given iterable object onto * the stack. The last element returned by the iterable object @@ -55,7 +76,7 @@ class Stack[+A] extends Seq[A] { * @param elems the iterable object. * @return the stack with the new elements on top. */ - def +[B >: A](elems: Iterable[B]): Stack[B] = + def push[B >: A](elems: Iterable[B]): Stack[B] = elems.foldLeft(this: Stack[B]){ (stack, elem) => stack + elem } /** Push a sequence of elements onto the stack. The last element |