2013-04-10 14:58:50 -07:00
|
|
|
// mutable maps (HashSets)
|
|
|
|
|
import scala.collection.mutable.HashMap
|
2013-10-27 22:24:23 +00:00
|
|
|
val hash = new HashMap[Int, Int]
|
2013-04-10 14:58:50 -07:00
|
|
|
hash(1) = 2
|
|
|
|
|
hash += (1 -> 2) // same as hash(1) = 2
|
|
|
|
|
hash += (3 -> 4, 5 -> 6, 44 -> 99)
|
|
|
|
|
hash(44) // 99
|
|
|
|
|
hash.contains(33) // false
|
|
|
|
|
hash.isDefinedAt(33) // same as contains
|
|
|
|
|
hash.contains(44) // true
|