summaryrefslogtreecommitdiff
path: root/src/library
diff options
context:
space:
mode:
authorPhilipp Haller <hallerp@gmail.com>2009-07-31 16:07:00 +0000
committerPhilipp Haller <hallerp@gmail.com>2009-07-31 16:07:00 +0000
commit24471facbd9ece2a972e47dfe792b0fae3356c50 (patch)
tree013f2740664d4a4dd540f69014fc32eaef9e222b /src/library
parentbe31fef41ad7585af15f3dc61be919ed9dc5ea1a (diff)
downloadscala-24471facbd9ece2a972e47dfe792b0fae3356c50.tar.gz
scala-24471facbd9ece2a972e47dfe792b0fae3356c50.tar.bz2
scala-24471facbd9ece2a972e47dfe792b0fae3356c50.zip
Fixed #2142 and #2143.
Diffstat (limited to 'src/library')
-rw-r--r--src/library/scala/collection/generic/TraversableFactory.scala4
-rw-r--r--src/library/scala/collection/immutable/Stream.scala12
2 files changed, 8 insertions, 8 deletions
diff --git a/src/library/scala/collection/generic/TraversableFactory.scala b/src/library/scala/collection/generic/TraversableFactory.scala
index 747dd993bb..b91556333a 100644
--- a/src/library/scala/collection/generic/TraversableFactory.scala
+++ b/src/library/scala/collection/generic/TraversableFactory.scala
@@ -173,8 +173,8 @@ abstract class TraversableFactory[CC[X] <: Traversable[X] with TraversableClass[
* @param f the function that's repeatedly applied
* @return the iterable returning `len` values in the sequence `start, f(start), f(f(start)), ...`
*/
- def iterate(start: Int, len: Int)(f: Int => Int): CC[Int] = {
- val b = newBuilder[Int]
+ def iterate[A](start: A, len: Int)(f: A => A): CC[A] = {
+ val b = newBuilder[A]
var acc = start
var i = 0
while (i < len) {
diff --git a/src/library/scala/collection/immutable/Stream.scala b/src/library/scala/collection/immutable/Stream.scala
index 862ac2cfc7..856e8b2aa8 100644
--- a/src/library/scala/collection/immutable/Stream.scala
+++ b/src/library/scala/collection/immutable/Stream.scala
@@ -448,9 +448,9 @@ object Stream extends SequenceFactory[Stream] {
* @param f the function that's repeatedly applied
* @return the stream returning the infinite sequence of values `start, f(start), f(f(start)), ...`
*/
- def iterate(start: Int)(f: Int => Int): Stream[Int] = new Cons(start, iterate(f(start))(f))
+ def iterate[A](start: A)(f: A => A): Stream[A] = new Cons(start, iterate(f(start))(f))
- override def iterate(start: Int, len: Int)(f: Int => Int): Stream[Int] =
+ override def iterate[A](start: A, len: Int)(f: A => A): Stream[A] =
iterate(start)(f) take len
/**
@@ -476,10 +476,10 @@ object Stream extends SequenceFactory[Stream] {
/**
* Create an infinite stream containing the given element expression (which is computed for each
* occurrence)
+ *
* @param elem the element composing the resulting stream
- * @return the stream containing an inifinite number of elem
+ * @return the stream containing an infinite number of elem
*/
- @deprecated("use `fill' instead")
def continually[A](elem: => A): Stream[A] = new Cons(elem, continually(elem))
override def fill[A](n: Int)(elem: => A): Stream[A] =
@@ -530,9 +530,9 @@ object Stream extends SequenceFactory[Stream] {
* Create an infinite stream containing the given element.
*
* @param elem the element composing the resulting stream
- * @return the stream containing an inifinite number of elem
+ * @return the stream containing an infinite number of elem
*/
- @deprecated("use fill(elem) instead")
+ @deprecated("use `continually' instead")
def const[A](elem: A): Stream[A] = cons(elem, const(elem))
/** Create a stream containing several copies of an element.