From 24471facbd9ece2a972e47dfe792b0fae3356c50 Mon Sep 17 00:00:00 2001 From: Philipp Haller Date: Fri, 31 Jul 2009 16:07:00 +0000 Subject: Fixed #2142 and #2143. --- .../scala/collection/generic/TraversableFactory.scala | 4 ++-- src/library/scala/collection/immutable/Stream.scala | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/library') 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. -- cgit v1.2.3