blob: ae82f3fd0fd16c617174160a0e5402aa47dc6d80 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
/* __ *\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2003-2009, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
// $Id$
package scala.collection.mutable
/** This class can be used as an adaptor to create mutable sets from
* Java classes that implement interface <code>java.util.Set</code>.
*
* @author Matthias Zenger
* @version 1.0, 19/09/2003
* @deprecated Use <code>scala.collection.jcl.Set(jmap)</code> instead
*/
@deprecated class JavaSetAdaptor[A](jset: java.util.Set[A]) extends Set[A] {
override def size: Int = jset.size()
override def isEmpty: Boolean = jset.isEmpty()
def contains(elem: A): Boolean = jset.contains(elem)
def elements: Iterator[A] = new Iterator[A] {
val iter = jset.iterator()
def hasNext = iter.hasNext()
def next = iter.next().asInstanceOf[A]
}
def +=(elem: A): Unit = { val x = jset.add(elem); }
def -=(elem: A): Unit = { val x = jset.remove(elem); }
override def clear(): Unit = jset.clear()
override def clone(): Set[A] = {
val res = new HashSet[A]
res ++= this
res
}
}
|