Anonymous user
Associative array/Creation: Difference between revisions
→{{header|Scala}}
Line 1,873:
=={{header|Scala}}==
<lang Scala>// immutable maps
var map = Map(1 -> 2, 3 -> 4, 5 -> 6)
Line 1,886 ⟶ 1,882:
<lang scala>// mutable maps (HashSets)
import scala.collection.mutable.HashMap
val hash = new HashMap[
hash(1) = 2
hash += (1 -> 2) // same as hash(1) = 2
|