blob: 32c4915a49dc97da358dd3a21a2e421d87e0b8b4 (
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
|
/* __ *\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2003-2009, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
// $Id: EmptySet.scala 16893 2009-01-13 13:09:22Z cunei $
package scalax.collection.immutable
import collection.generic.Builder
/** This class implements empty immutable sets
* @author Martin Oderskty
* @version 1.0, 019/01/2007
*/
@serializable
class EmptySet[A] extends Set[A] {
def size: Int = 0
def contains(elem: A): Boolean = false
def + (elem: A): Set[A] = new Set1(elem)
def - (elem: A): Set[A] = this
def elements: Iterator[A] = Iterator.empty
override def foreach(f: A => Unit): Unit = {}
}
|