blob: 5b39aaa3a4aa1d6d950e811a1d9917ef5a791efe (
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
|
/* __ *\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2003-2009, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
// $Id: Set.scala 16893 2009-01-13 13:09:22Z cunei $
package scalax.collection.immutable
import collection.generic._
object Set extends generic.SetFactory[Set] {
private val hashSeed = "Set".hashCode
def empty[A]: Set[A] = null // !!!
}
trait Set[A] extends OrderedIterable[A]
with collection.Set[A]
with SetTemplate[Set, A] {
/** Compares this set with another object and returns true, iff the
* other object is also a set which contains the same elements as
* this set.
*
* @param that the other object
* @note not necessarily run-time type safe.
* @return <code>true</code> iff this set and the other set
* contain the same elements.
*/
override def equals(that: Any): Boolean = that match {
case other: Set[_] =>
this.size == other.size && subsetOf(other.asInstanceOf[Set[A]])
case _ =>
false
}
override def hashCode = (Set.hashSeed /: this)(_ * 41 + _.hashCode)
}
|