diff options
author | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2010-07-09 11:31:34 +0000 |
---|---|---|
committer | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2010-07-09 11:31:34 +0000 |
commit | 0394b8426ff8ad41f0455c5318518d1a84540290 (patch) | |
tree | cdeea67c12a8750d35c6073a832eab3f7cb25f9f /src/library | |
parent | c66898e5be37d88efd75af76f5a078820ae6c4e0 (diff) | |
download | scala-0394b8426ff8ad41f0455c5318518d1a84540290.tar.gz scala-0394b8426ff8ad41f0455c5318518d1a84540290.tar.bz2 scala-0394b8426ff8ad41f0455c5318518d1a84540290.zip |
closes #3603. no review
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/collection/immutable/IntMap.scala | 16 | ||||
-rw-r--r-- | src/library/scala/collection/immutable/LongMap.scala | 25 |
2 files changed, 39 insertions, 2 deletions
diff --git a/src/library/scala/collection/immutable/IntMap.scala b/src/library/scala/collection/immutable/IntMap.scala index ba5cd896ac..d4605d3e1f 100644 --- a/src/library/scala/collection/immutable/IntMap.scala +++ b/src/library/scala/collection/immutable/IntMap.scala @@ -11,6 +11,14 @@ package scala.collection package immutable; + + +import scala.collection.generic.CanBuildFrom +import scala.collection.mutable.Builder +import scala.collection.mutable.MapBuilder + + + /** Utility class for integer maps. * @author David MacIver */ @@ -53,6 +61,12 @@ import IntMapUtils._ * @since 2.7 */ object IntMap { + /** $mapCanBuildFromInfo */ + implicit def canBuildFrom[A, B] = new CanBuildFrom[IntMap[A], (Int, B), IntMap[B]] { + def apply(from: IntMap[A]): Builder[(Int, B), IntMap[B]] = apply() + def apply(): Builder[(Int, B), IntMap[B]] = new MapBuilder[Int, B, IntMap[B]](empty[B]) + } + def empty[T] : IntMap[T] = IntMap.Nil; def singleton[T](key : Int, value : T) : IntMap[T] = IntMap.Tip(key, value); def apply[T](elems : (Int, T)*) : IntMap[T] = @@ -147,7 +161,7 @@ import IntMap._ /** Specialised immutable map structure for integer keys, based on * <a href="http://citeseer.ist.psu.edu/okasaki98fast.html">Fast Mergeable Integer Maps</a> - * by Okasaki and Gill. Essentially a trie based on binary digits of the the integers. + * by Okasaki and Gill. Essentially a trie based on binary digits of the integers. * * Note: This class is as of 2.8 largely superseded by HashMap. * diff --git a/src/library/scala/collection/immutable/LongMap.scala b/src/library/scala/collection/immutable/LongMap.scala index 691a81d9f0..dcdc6e948f 100644 --- a/src/library/scala/collection/immutable/LongMap.scala +++ b/src/library/scala/collection/immutable/LongMap.scala @@ -1,6 +1,23 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2003-2010, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + + + package scala.collection package immutable + +import scala.collection.generic.CanBuildFrom +import scala.collection.mutable.Builder +import scala.collection.mutable.MapBuilder + + + /** Utility class for long maps. * @author David MacIver */ @@ -44,6 +61,12 @@ import LongMapUtils._ * @since 2.7 */ object LongMap{ + /** $mapCanBuildFromInfo */ + implicit def canBuildFrom[A, B] = new CanBuildFrom[LongMap[A], (Long, B), LongMap[B]] { + def apply(from: LongMap[A]): Builder[(Long, B), LongMap[B]] = apply() + def apply(): Builder[(Long, B), LongMap[B]] = new MapBuilder[Long, B, LongMap[B]](empty[B]) + } + def empty[T] : LongMap[T] = LongMap.Nil; def singleton[T](key : Long, value : T) : LongMap[T] = LongMap.Tip(key, value); def apply[T](elems : (Long, T)*) : LongMap[T] = @@ -136,7 +159,7 @@ import LongMap._; /** * Specialised immutable map structure for long keys, based on * <a href="http://citeseer.ist.psu.edu/okasaki98fast.html">Fast Mergeable Long Maps</a> - * by Okasaki and Gill. Essentially a trie based on binary digits of the the integers. + * by Okasaki and Gill. Essentially a trie based on binary digits of the integers. * * Note: This class is as of 2.8 largely superseded by HashMap. * |