Jump to content

Associative array/Creation: Difference between revisions

Line 1,873:
 
=={{header|Scala}}==
[[Category:Scala Implementations]]
{{libheader|Scala}}
[[Category:Scala examples needing attention]]
 
<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[intInt, intInt]
hash(1) = 2
hash += (1 -> 2) // same as hash(1) = 2
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.