diff options
author | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2010-04-08 13:05:33 +0000 |
---|---|---|
committer | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2010-04-08 13:05:33 +0000 |
commit | a2f3507a56597002f26bbd8d417e6cd7c15481c7 (patch) | |
tree | 4faa4480e3c197fb691ef11b3d8e1d19b7fc956c /src | |
parent | af6da0b41ead7863216af0aaea83d5463fa93bfd (diff) | |
download | scala-a2f3507a56597002f26bbd8d417e6cd7c15481c7.tar.gz scala-a2f3507a56597002f26bbd8d417e6cd7c15481c7.tar.bz2 scala-a2f3507a56597002f26bbd8d417e6cd7c15481c7.zip |
Mostly some undocumented stuff in JavaConversions.
Diffstat (limited to 'src')
-rw-r--r-- | src/library/scala/collection/JavaConversions.scala | 21 | ||||
-rw-r--r-- | src/library/scala/collection/MapLike.scala | 6 | ||||
-rw-r--r-- | src/library/scala/collection/SetLike.scala | 2 |
3 files changed, 25 insertions, 4 deletions
diff --git a/src/library/scala/collection/JavaConversions.scala b/src/library/scala/collection/JavaConversions.scala index 00f2d745af..20f44b7f21 100644 --- a/src/library/scala/collection/JavaConversions.scala +++ b/src/library/scala/collection/JavaConversions.scala @@ -25,6 +25,8 @@ package scala.collection * <li><code>scala.collection.mutable.Buffer</code> <=> <code>java.util.List</code></li> * <li><code>scala.collection.mutable.Set</code> <=> <code>java.util.Set</code></li> * <li><code>scala.collection.mutable.Map</code> <=> <code>java.util.Map</code></li> + * <li><code>scala.collection.mutable.ConcurrentMap</code> <=> <code>java.util.concurrent.ConcurrentMap</code></li> + * <li><code>java.util.Properties</code></li> => <code>scala.collection.mutable.Map[String, String]</code></li> * </ul> * <p> * In all cases, converting from a source type to a target type and back @@ -184,6 +186,16 @@ object JavaConversions { case _ => new MutableMapWrapper(m)(ma) } + /** + * Implicitly converts a Scala mutable `ConcurrentMap` to a Java `ConcurrentMap`. + * The returned Java `ConcurrentMap` is backed by the provided Scala `ConcurrentMap` + * and any side-effects of using it via the Java interface will be visible + * via the Scala interface and vice versa. + * <p> + * If the Scala <code>ConcurrentMap</code> was previously obtained from an implicit or + * explicit call of <code>asConcurrentMap(java.util.concurrect.ConcurrentMap)</code> then the original + * Java <code>ConcurrentMap</code> will be returned. + */ implicit def asConcurrentMap[A, B](m: mutable.ConcurrentMap[A, B]) (implicit ma: ClassManifest[A], mb: ClassManifest[B]): juc.ConcurrentMap[A, B] = m match { case JConcurrentMapWrapper(wrapped) => wrapped @@ -334,6 +346,15 @@ object JavaConversions { case _ => new JConcurrentMapWrapper(m) } + /** + * Implicitly converts a Java <code>Properties</code> to a Scala mutable <code>Map[String, String]</code>. + * The returned Scala <code>Map[String, String]</code> is backed by the provided Java + * <code>Properties</code> and any side-effects of using it via the Scala interface will + * be visible via the Java interface and vice versa. + * + * @param m The <code>Properties</code> to be converted. + * @return A Scala mutable <code>Map[String, String]</code> view of the argument. + */ implicit def asMap(p: ju.Properties): mutable.Map[String, String] = p match { case _ => new JPropertiesWrapper(p) } diff --git a/src/library/scala/collection/MapLike.scala b/src/library/scala/collection/MapLike.scala index 5e1af7a2d7..6a9fffe3e1 100644 --- a/src/library/scala/collection/MapLike.scala +++ b/src/library/scala/collection/MapLike.scala @@ -60,7 +60,7 @@ self => // note: can't inherit Addable because of variance problems: Map // is covariant in its value type B, but Addable is nonvariant. - /* The empty map of the same type as this map + /** The empty map of the same type as this map * @return an empty map of type `This`. */ def empty: This @@ -295,7 +295,7 @@ self => * @param p A predicate over key-value pairs * @note This method works by successively removing elements fro which the * predicate is false from this set. - * If removal is slow, or you expect that most elements of the set$ + * If removal is slow, or you expect that most elements of the set * will be removed, you might consider using <code>filter</code> * with a negated predicate instead. */ @@ -311,7 +311,7 @@ self => * `end`. Inside, the string representations of all bindings of this map * in the form of `key -> value` are separated by the string `sep`. * - * @param b the builder to which strings are appended. + * @param b the builder to which strings are appended. * @param start the starting string. * @param sep the separator string. * @param end the ending string. diff --git a/src/library/scala/collection/SetLike.scala b/src/library/scala/collection/SetLike.scala index 48b5358afc..44dac8e8fe 100644 --- a/src/library/scala/collection/SetLike.scala +++ b/src/library/scala/collection/SetLike.scala @@ -53,7 +53,7 @@ extends IterableLike[A, This] with Subtractable[A, This] { self => - /* The empty set of the same type as this set + /** The empty set of the same type as this set * @return an empty set of type `This`. */ def empty: This |