diff options
Diffstat (limited to 'src/library/scala/collection/jcl/IterableWrapper.scala')
-rw-r--r-- | src/library/scala/collection/jcl/IterableWrapper.scala | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/library/scala/collection/jcl/IterableWrapper.scala b/src/library/scala/collection/jcl/IterableWrapper.scala new file mode 100644 index 0000000000..caa31d10cf --- /dev/null +++ b/src/library/scala/collection/jcl/IterableWrapper.scala @@ -0,0 +1,32 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2006-2007, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +// $Id$ + +package scala.collection.jcl; + +/** A wrapper around a Java collection that only supports remove mutations. + * + * @author Sean McDirmid + */ +trait IterableWrapper[A] extends MutableIterable[A] { + def underlying: java.util.Collection[A]; + override def remove(a: A) = underlying.remove(a); + override def removeAll(that: Iterable[A]) = that match { + case that: IterableWrapper[_] => underlying.removeAll(that.underlying); + case _ => super.removeAll(that); + } + override def retainAll(that : Iterable[A]) = that match { + case that : IterableWrapper[_] => underlying.retainAll(that.underlying); + case _ => super.retainAll(that); + } + override def size = underlying.size; + override def isEmpty = underlying.isEmpty; + override def clear = underlying.clear; + override def elements : MutableIterator[A] = new MutableIterator.Wrapper[A](underlying.iterator); +} |