summaryrefslogtreecommitdiff
path: root/src/library/scala/collection/Iterator.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2009-08-17 21:16:39 +0000
committerPaul Phillips <paulp@improving.org>2009-08-17 21:16:39 +0000
commit8df11b38aaf1ee3a481aebba97f0ddcba535c241 (patch)
tree6e701d3a2e5c35a94079bc838f1362ffb49e16c0 /src/library/scala/collection/Iterator.scala
parent22fcda03418bafc85f6fd6f38f2478677b99c932 (diff)
downloadscala-8df11b38aaf1ee3a481aebba97f0ddcba535c241.tar.gz
scala-8df11b38aaf1ee3a481aebba97f0ddcba535c241.tar.bz2
scala-8df11b38aaf1ee3a481aebba97f0ddcba535c241.zip
More fleshing out Codec.
positioning change. Deleted instead of deprecated the two argument version of Iterator.iterate since it did not exist in 2.7.
Diffstat (limited to 'src/library/scala/collection/Iterator.scala')
-rw-r--r--src/library/scala/collection/Iterator.scala14
1 files changed, 2 insertions, 12 deletions
diff --git a/src/library/scala/collection/Iterator.scala b/src/library/scala/collection/Iterator.scala
index dabbc86cbc..9dad248462 100644
--- a/src/library/scala/collection/Iterator.scala
+++ b/src/library/scala/collection/Iterator.scala
@@ -102,24 +102,14 @@ object Iterator {
else empty.next()
}
- /** An iterator that repeatedly applies a given function to a start value.
- *
- * @param start the start value of the iterator
- * @param len the number of elements returned by the iterator
- * @param f the function that's repeatedly applied
- * @return the iterator returning `len` values in the sequence `start, f(start), f(f(start)), ...`
- */
- @deprecated("Use `iterate(start)(f) take len' instead")
- def iterate[T](start: T, len: Int)(f: T => T): Iterator[T] = iterate(start)(f) take len
-
- /** An infinite iterator that repeatedly applies a given function to a start value.
+ /** An infinite iterator that repeatedly applies a given function to the previous result.
*
* @param start the start value of the iterator
* @param f the function that's repeatedly applied
* @return the iterator returning the infinite sequence of values `start, f(start), f(f(start)), ...`
*/
def iterate[T](start: T)(f: T => T): Iterator[T] = new Iterator[T] {
- private var acc = start
+ private[this] var acc = start
def hasNext: Boolean = true
def next(): T = { val res = acc ; acc = f(acc) ; res }
}