Skip to content

Commit 3bf207b

Browse files
committed
Cleaned up Scaladoc for JavaConverters and non-deprecated friends
1 parent 0c5b42d commit 3bf207b

File tree

7 files changed

+261
-872
lines changed

7 files changed

+261
-872
lines changed

src/library/scala/collection/JavaConversions.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ package collection
1111

1212
import convert._
1313

14-
/** A collection of implicit conversions supporting interoperability between
14+
/** A variety of implicit conversions supporting interoperability between
1515
* Scala and Java collections.
1616
*
1717
* The following conversions are supported:

src/library/scala/collection/convert/AsJavaConverters.scala

Lines changed: 109 additions & 121 deletions
Large diffs are not rendered by default.

src/library/scala/collection/convert/AsScalaConverters.scala

Lines changed: 77 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* __ *\
22
** ________ ___ / / ___ Scala API **
3-
** / __/ __// _ | / / / _ | (c) 2006-2013, LAMP/EPFL **
3+
** / __/ __// _ | / / / _ | (c) 2006-2016, LAMP/EPFL **
44
** __\ \/ /__/ __ |/ /__/ __ | http://www.scala-lang.org/ **
55
** /____/\___/_/ |_/____/_/ | | **
66
** |/ **
@@ -19,36 +19,34 @@ trait AsScalaConverters {
1919
/**
2020
* Converts a Java `Iterator` to a Scala `Iterator`.
2121
*
22-
* The returned Scala `Iterator` is backed by the provided Java `Iterator`
23-
* and any side-effects of using it via the Scala interface will be visible
24-
* via the Java interface and vice versa.
22+
* The returned Scala `Iterator` is backed by the provided Java `Iterator` and any side-effects of
23+
* using it via the Scala interface will be visible via the Java interface and vice versa.
2524
*
26-
* If the Java `Iterator` was previously obtained from an implicit or
27-
* explicit call of `asJavaIterator(scala.collection.Iterator)` then the
28-
* original Scala `Iterator` will be returned.
25+
* If the Java `Iterator` was previously obtained from an implicit or explicit call of
26+
* `[[JavaConverters.asJavaIterator]](scala.collection.Iterator)` then the original Scala
27+
* `Iterator` will be returned.
2928
*
30-
* @param it The `Iterator` to be converted.
31-
* @return A Scala `Iterator` view of the argument.
29+
* @param i The Java `Iterator` to be converted.
30+
* @return A Scala `Iterator` view of the argument.
3231
*/
33-
def asScalaIterator[A](it: ju.Iterator[A]): Iterator[A] = it match {
32+
def asScalaIterator[A](i: ju.Iterator[A]): Iterator[A] = i match {
3433
case null => null
3534
case IteratorWrapper(wrapped) => wrapped
36-
case _ => JIteratorWrapper(it)
35+
case _ => JIteratorWrapper(i)
3736
}
3837

3938
/**
40-
* Converts a Java Enumeration to a Scala Iterator.
39+
* Converts a Java `Enumeration` to a Scala `Iterator`.
4140
*
42-
* The returned Scala Iterator is backed by the provided Java
43-
* Enumeration and any side-effects of using it via the Scala interface will
44-
* be visible via the Java interface and vice versa.
41+
* The returned Scala `Iterator` is backed by the provided Java `Enumeration` and any side-effects
42+
* of using it via the Scala interface will be visible via the Java interface and vice versa.
4543
*
46-
* If the Java Enumeration was previously obtained from an implicit or
47-
* explicit call of `asJavaEnumeration(scala.collection.Iterator)`
48-
* then the original Scala Iterator will be returned.
44+
* If the Java `Enumeration` was previously obtained from an implicit or explicit call of
45+
* `[[JavaConverters.asJavaEnumeration]](scala.collection.Iterator)` then the original Scala
46+
* `Iterator` will be returned.
4947
*
50-
* @param i The Enumeration to be converted.
51-
* @return A Scala Iterator view of the argument.
48+
* @param i The Java `Enumeration` to be converted.
49+
* @return A Scala `Iterator` view of the argument.
5250
*/
5351
def enumerationAsScalaIterator[A](i: ju.Enumeration[A]): Iterator[A] = i match {
5452
case null => null
@@ -59,16 +57,15 @@ trait AsScalaConverters {
5957
/**
6058
* Converts a Java `Iterable` to a Scala `Iterable`.
6159
*
62-
* The returned Scala `Iterable` is backed by the provided Java `Iterable`
63-
* and any side-effects of using it via the Scala interface will be visible
64-
* via the Java interface and vice versa.
60+
* The returned Scala `Iterable` is backed by the provided Java `Iterable` and any side-effects of
61+
* using it via the Scala interface will be visible via the Java interface and vice versa.
6562
*
66-
* If the Java `Iterable` was previously obtained from an implicit or
67-
* explicit call of `asJavaIterable(scala.collection.Iterable)`
68-
* then the original Scala Iterable will be returned.
63+
* If the Java `Iterable` was previously obtained from an implicit or explicit call of
64+
* `[[JavaConverters.asJavaIterable]](scala.collection.Iterable) then the original Scala
65+
* `Iterable` will be returned.
6966
*
70-
* @param i The Iterable to be converted.
71-
* @return A Scala Iterable view of the argument.
67+
* @param i The Java `Iterable` to be converted.
68+
* @return A Scala `Iterable` view of the argument.
7269
*/
7370
def iterableAsScalaIterable[A](i: jl.Iterable[A]): Iterable[A] = i match {
7471
case null => null
@@ -79,12 +76,12 @@ trait AsScalaConverters {
7976
/**
8077
* Converts a Java `Collection` to an Scala `Iterable`.
8178
*
82-
* If the Java `Collection` was previously obtained from an implicit or
83-
* explicit call of `asJavaCollection(scala.collection.Iterable)`
84-
* then the original Scala `Iterable` will be returned.
79+
* If the Java `Collection` was previously obtained from an implicit or explicit call of
80+
* `[[JavaConverters.asJavaCollection]](scala.collection.Iterable)` then the original Scala
81+
* `Iterable` will be returned.
8582
*
86-
* @param i The Collection to be converted.
87-
* @return A Scala Iterable view of the argument.
83+
* @param i The Java `Collection` to be converted.
84+
* @return A Scala `Iterable` view of the argument.
8885
*/
8986
def collectionAsScalaIterable[A](i: ju.Collection[A]): Iterable[A] = i match {
9087
case null => null
@@ -95,15 +92,14 @@ trait AsScalaConverters {
9592
/**
9693
* Converts a Java `List` to a Scala mutable `Buffer`.
9794
*
98-
* The returned Scala `Buffer` is backed by the provided Java `List`
99-
* and any side-effects of using it via the Scala interface will
100-
* be visible via the Java interface and vice versa.
95+
* The returned Scala `Buffer` is backed by the provided Java `List` and any side-effects of using
96+
* it via the Scala interface will be visible via the Java interface and vice versa.
10197
*
102-
* If the Java `List` was previously obtained from an implicit or
103-
* explicit call of `bufferAsJavaList(scala.collection.mutable.Buffer)`
104-
* then the original Scala `Buffer` will be returned.
98+
* If the Java `List` was previously obtained from an implicit or explicit call of
99+
* `[[JavaConverters.bufferAsJavaList]](scala.collection.mutable.Buffer)` then the original Scala
100+
* `Buffer` will be returned.
105101
*
106-
* @param l The `List` to be converted.
102+
* @param l The Java `List` to be converted.
107103
* @return A Scala mutable `Buffer` view of the argument.
108104
*/
109105
def asScalaBuffer[A](l: ju.List[A]): mutable.Buffer[A] = l match {
@@ -113,18 +109,17 @@ trait AsScalaConverters {
113109
}
114110

115111
/**
116-
* Converts a Java Set to a Scala mutable Set.
112+
* Converts a Java `Set` to a Scala mutable `Set`.
117113
*
118-
* The returned Scala Set is backed by the provided Java
119-
* Set and any side-effects of using it via the Scala interface will
120-
* be visible via the Java interface and vice versa.
114+
* The returned Scala `Set` is backed by the provided Java `Set` and any side-effects of using it
115+
* via the Scala interface will be visible via the Java interface and vice versa.
121116
*
122-
* If the Java Set was previously obtained from an implicit or
123-
* explicit call of `mutableSetAsJavaSet(scala.collection.mutable.Set)` then
124-
* the original Scala Set will be returned.
117+
* If the Java `Set` was previously obtained from an implicit or explicit call of
118+
* `[[JavaConverters.mutableSetAsJavaSet]](scala.collection.mutable.Set)` then the original Scala
119+
* `Set` will be returned.
125120
*
126-
* @param s The Set to be converted.
127-
* @return A Scala mutable Set view of the argument.
121+
* @param s The Java `Set` to be converted.
122+
* @return A Scala mutable `Set` view of the argument.
128123
*/
129124
def asScalaSet[A](s: ju.Set[A]): mutable.Set[A] = s match {
130125
case null => null
@@ -135,22 +130,20 @@ trait AsScalaConverters {
135130
/**
136131
* Converts a Java `Map` to a Scala mutable `Map`.
137132
*
138-
* The returned Scala `Map` is backed by the provided Java `Map` and any
139-
* side-effects of using it via the Scala interface will be visible via
140-
* the Java interface and vice versa.
133+
* The returned Scala `Map` is backed by the provided Java `Map` and any side-effects of using it
134+
* via the Scala interface will be visible via the Java interface and vice versa.
141135
*
142-
* If the Java `Map` was previously obtained from an implicit or
143-
* explicit call of `mutableMapAsJavaMap(scala.collection.mutable.Map)` then
144-
* the original Scala Map will be returned.
136+
* If the Java `Map` was previously obtained from an implicit or explicit call of
137+
* `[[JavaConverters.mutableMapAsJavaMap]](scala.collection.mutable.Map)` then the original Scala
138+
* `Map` will be returned.
145139
*
146-
* If the wrapped map is synchronized (e.g. from `java.util.Collections.synchronizedMap`),
147-
* it is your responsibility to wrap all
148-
* non-atomic operations with `underlying.synchronized`.
149-
* This includes `get`, as `java.util.Map`'s API does not allow for an
150-
* atomic `get` when `null` values may be present.
140+
* If the wrapped map is synchronized (e.g. from `java.util.Collections.synchronizedMap`), it is
141+
* your responsibility to wrap all non-atomic operations with `underlying.synchronized`.
142+
* This includes `get`, as `java.util.Map`'s API does not allow for an atomic `get` when `null`
143+
* values may be present.
151144
*
152-
* @param m The Map to be converted.
153-
* @return A Scala mutable Map view of the argument.
145+
* @param m The Java `Map` to be converted.
146+
* @return A Scala mutable `Map` view of the argument.
154147
*/
155148
def mapAsScalaMap[A, B](m: ju.Map[A, B]): mutable.Map[A, B] = m match {
156149
case null => null
@@ -159,18 +152,18 @@ trait AsScalaConverters {
159152
}
160153

161154
/**
162-
* Converts a Java ConcurrentMap to a Scala mutable ConcurrentMap.
155+
* Converts a Java `ConcurrentMap` to a Scala mutable `ConcurrentMap`.
163156
*
164-
* The returned Scala ConcurrentMap is backed by the provided Java
165-
* ConcurrentMap and any side-effects of using it via the Scala interface will
166-
* be visible via the Java interface and vice versa.
157+
* The returned Scala `ConcurrentMap` is backed by the provided Java `ConcurrentMap` and any
158+
* side-effects of using it via the Scala interface will be visible via the Java interface and
159+
* vice versa.
167160
*
168-
* If the Java ConcurrentMap was previously obtained from an implicit or
169-
* explicit call of `mapAsJavaConcurrentMap(scala.collection.mutable.ConcurrentMap)`
170-
* then the original Scala ConcurrentMap will be returned.
161+
* If the Java `ConcurrentMap` was previously obtained from an implicit or explicit call of
162+
* `[[JavaConverters.mapAsJavaConcurrentMap]](scala.collection.mutable.ConcurrentMap)`
163+
* then the original Scala `ConcurrentMap` will be returned.
171164
*
172-
* @param m The ConcurrentMap to be converted.
173-
* @return A Scala mutable ConcurrentMap view of the argument.
165+
* @param m The Java `ConcurrentMap` to be converted.
166+
* @return A Scala mutable `ConcurrentMap` view of the argument.
174167
*/
175168
def mapAsScalaConcurrentMap[A, B](m: juc.ConcurrentMap[A, B]): concurrent.Map[A, B] = m match {
176169
case null => null
@@ -181,16 +174,15 @@ trait AsScalaConverters {
181174
/**
182175
* Converts a Java `Dictionary` to a Scala mutable `Map`.
183176
*
184-
* The returned Scala `Map` is backed by the provided Java
185-
* `Dictionary` and any side-effects of using it via the Scala interface
186-
* will be visible via the Java interface and vice versa.
177+
* The returned Scala `Map` is backed by the provided Java `Dictionary` and any side-effects of
178+
* using it via the Scala interface will be visible via the Java interface and vice versa.
187179
*
188-
* If the Java `Dictionary` was previously obtained from an implicit or
189-
* explicit call of `asJavaDictionary(scala.collection.mutable.Map)` then the original
190-
* Scala Map will be returned.
180+
* If the Java `Dictionary` was previously obtained from an implicit or explicit call of
181+
* `[[JavaConverters.asJavaDictionary]](scala.collection.mutable.Map)` then the original
182+
* Scala `Map` will be returned.
191183
*
192-
* @param p The Dictionary to be converted.
193-
* @return A Scala mutable Map view of the argument.
184+
* @param p The Java `Dictionary` to be converted.
185+
* @return A Scala mutable `Map` view of the argument.
194186
*/
195187
def dictionaryAsScalaMap[A, B](p: ju.Dictionary[A, B]): mutable.Map[A, B] = p match {
196188
case null => null
@@ -199,14 +191,14 @@ trait AsScalaConverters {
199191
}
200192

201193
/**
202-
* Converts a Java `Properties` to a Scala `mutable Map[String, String]`.
194+
* Converts a Java `Properties` to a Scala mutable `Map[String, String]`.
203195
*
204-
* The returned Scala `Map[String, String]` is backed by the provided Java
205-
* `Properties` and any side-effects of using it via the Scala interface
206-
* will be visible via the Java interface and vice versa.
196+
* The returned Scala `Map[String, String]` is backed by the provided Java `Properties` and any
197+
* side-effects of using it via the Scala interface will be visible via the Java interface and
198+
* vice versa.
207199
*
208-
* @param p The Properties to be converted.
209-
* @return A Scala mutable Map[String, String] view of the argument.
200+
* @param p The Java `Properties` to be converted.
201+
* @return A Scala mutable `Map[String, String]` view of the argument.
210202
*/
211203
def propertiesAsScalaMap(p: ju.Properties): mutable.Map[String, String] = p match {
212204
case null => null

0 commit comments

Comments
 (0)