blob: 79a31cc5ef7a776481223d1b7410d682e6945d95 (
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
|
/* __ *\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2003-2009, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
// $Id$
package scala.collection.mutable
import generic._
/** This class represents mutable sets. Concrete set implementations
* have to provide functionality for the abstract methods in Set:
*
* def contains(elem: A): Boolean
* def elements: Iterator[A]
* def += (elem: A): this.type
* def -= (elem: A): this.type
*
* @author Matthias Zenger
* @author Martin Odersky
* @version 2.8
*/
trait Set[A] extends Iterable[A]
with collection.Set[A]
with MutableSetTemplate[A, Set[A]]
with Unhashable {
override def empty = Set.empty
override def traversableBuilder[B]: Builder[B, Set[B]] = Set.newBuilder[B]
}
/** The canonical factory methods for <a href="Set.html">mutable sets</a>.
* Currently this returns a HashSet.
*/
object Set extends SetFactory[Set] {
type Coll = Set[_]
implicit def builderFactory[A]: BuilderFactory[A, Set[A], Coll] = new BuilderFactory[A, Set[A], Coll] { def apply(from: Coll) = from.traversableBuilder[A] }
def empty[A]: Set[A] = HashSet.empty[A]
}
|