summaryrefslogtreecommitdiff
path: root/src/library/scala/collection/generic/TraversibleView.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2009-05-08 16:33:15 +0000
committerMartin Odersky <odersky@gmail.com>2009-05-08 16:33:15 +0000
commit14a631a5fec42d04d0723355a0b93e482b5e4662 (patch)
treef639c2a22e89e193b9abea391993ecfd4d5326ee /src/library/scala/collection/generic/TraversibleView.scala
parent2379eb4ebbd28c8892b50a1d9fa8a687099eea4d (diff)
downloadscala-14a631a5fec42d04d0723355a0b93e482b5e4662.tar.gz
scala-14a631a5fec42d04d0723355a0b93e482b5e4662.tar.bz2
scala-14a631a5fec42d04d0723355a0b93e482b5e4662.zip
massive new collections checkin.
Diffstat (limited to 'src/library/scala/collection/generic/TraversibleView.scala')
-rwxr-xr-xsrc/library/scala/collection/generic/TraversibleView.scala29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/library/scala/collection/generic/TraversibleView.scala b/src/library/scala/collection/generic/TraversibleView.scala
new file mode 100755
index 0000000000..8c45e9690d
--- /dev/null
+++ b/src/library/scala/collection/generic/TraversibleView.scala
@@ -0,0 +1,29 @@
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2003-2009, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+package scala.collection.generic
+
+import Math.MAX_INT
+import TraversibleView.NoBuilder
+
+/** A base class for views of Traversible.
+ * Every subclass has to implenment the foreach method
+ * @author Martin Odersky
+ * @version 2.8
+ */
+trait TraversibleView[+A, +Coll <: Traversible[_]] extends TraversibleViewTemplate[A, Coll, TraversibleView[A, Coll]]
+
+object TraversibleView {
+ class NoBuilder[A] extends Builder[A, Nothing, TraversibleView[_, _]] {
+ def +=(elem: A) {}
+ def elements: Iterator[A] = Iterator.empty
+ def result() = throw new UnsupportedOperationException("TraversibleView.Builder.result")
+ def clear() {}
+ }
+ type Coll = TraversibleView[_, _]
+ implicit def builderFactory[A]: BuilderFactory[A, TraversibleView[A, Traversible[_]], Coll] = new BuilderFactory[A, TraversibleView[A, Traversible[_]], Coll] { def apply(from: Coll) = new NoBuilder }
+}