diff options
author | Martin Odersky <odersky@gmail.com> | 2015-10-05 17:43:55 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-10-06 13:54:36 +0200 |
commit | d42f4fee8717a91c845b6b8e1eaa053927f4b7e9 (patch) | |
tree | 588b3c901dd884a52726490cb0c8fab6a78d4d33 /src | |
parent | 1521121b573c9e4766fd66c080d44c9af099b438 (diff) | |
download | dotty-d42f4fee8717a91c845b6b8e1eaa053927f4b7e9.tar.gz dotty-d42f4fee8717a91c845b6b8e1eaa053927f4b7e9.tar.bz2 dotty-d42f4fee8717a91c845b6b8e1eaa053927f4b7e9.zip |
Tweaks to conform with API set out in #818.
Diffstat (limited to 'src')
-rw-r--r-- | src/strawman/collections/CollectionStrawMan1.scala | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/strawman/collections/CollectionStrawMan1.scala b/src/strawman/collections/CollectionStrawMan1.scala index 93d4086f2..2e9e5080e 100644 --- a/src/strawman/collections/CollectionStrawMan1.scala +++ b/src/strawman/collections/CollectionStrawMan1.scala @@ -20,9 +20,6 @@ object CollectionStrawMan1 { def iterator: Iterator[A] } - /** Iterator guaranteed to be usable multiple times */ - trait HasIterator[+A] extends CanIterate[A] - /** Base trait for instances that can construct a collection from an iterator */ trait FromIterator[+C[X] <: Iterable[X]] { def fromIterator[B](it: Iterator[B]): C[B] @@ -35,7 +32,7 @@ object CollectionStrawMan1 { } /** Base trait for generic collections */ - trait Iterable[+A] extends HasIterator[A] with FromIterator[Iterable] + trait Iterable[+A] extends CanIterate[A] with FromIterator[Iterable] /** Base trait for sequence collections */ trait Seq[+A] extends Iterable[A] with FromIterator[Seq] { @@ -55,7 +52,7 @@ object CollectionStrawMan1 { def isEmpty: Boolean = !iterator.hasNext def head: A = iterator.next def view: View[A] = new View(iterator) - def collect[C[X] <: Iterable[X]](fi: FromIterator[C]): C[A] = fi.fromIterator(iterator) + def collectAs[C[X] <: Iterable[X]](fi: FromIterator[C]): C[A] = fi.fromIterator(iterator) } /** Transforms returning same collection type */ @@ -213,13 +210,13 @@ object CollectionStrawMan1 { } /** Concrete collection type: View */ - class View[+A](it: => Iterator[A]) extends HasIterator[A] { + class View[+A](it: => Iterator[A]) extends CanIterate[A] { def iterator = it } implicit class ViewOps[A](val v: View[A]) extends AnyVal with Ops[A] { def iterator = v.iterator - def cache = collect(ArrayBuffer).view + def cache = collectAs(ArrayBuffer).view } implicit class ViewMonoTransforms[A](val v: View[A]) |