Skip to content

Instantly share code, notes, and snippets.

@lrytz
Created March 2, 2020 10:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lrytz/61f6fe3fa98a1ee23815e6301ecc2c0a to your computer and use it in GitHub Desktop.
Save lrytz/61f6fe3fa98a1ee23815e6301ecc2c0a to your computer and use it in GitHub Desktop.
➜ sandbox git:(2.13.x) ~/Applications/bin/scala-runners/scala -212x
Welcome to Scala 2.12.11-bin-d1e9ac0 (Java HotSpot(TM) 64-Bit GraalVM EE 19.2.1, Java 1.8.0_231).
Type in expressions for evaluation. Or try :help.
scala> case class K(var x: Int)
defined class K
scala> val k = K(1)
k: K = K(1)
scala> val m = collection.immutable.HashMap(k -> "hi")
m: scala.collection.immutable.HashMap[K,String] = Map(K(1) -> hi)
scala> val s = m.keySet
s: scala.collection.immutable.Set[K] = Set(K(1))
scala> s.hashCode
res0: Int = 240826701
scala> k.x = 10
k.x: Int = 10
scala> s.hashCode
res1: Int = 240826701
scala>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment