diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/library/scala/collection/generic/TraversableFactory.scala | 4 | ||||
-rw-r--r-- | src/library/scala/collection/immutable/Stream.scala | 12 |
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. |