Skip to content

Instantly share code, notes, and snippets.

@steshaw
Created May 15, 2010 03:20
Show Gist options
  • Save steshaw/401978 to your computer and use it in GitHub Desktop.
Save steshaw/401978 to your computer and use it in GitHub Desktop.
scala> new Foo(1, "one")
res0: Foo = Foo(1,one)
scala> new Foo(1, "one").hashCode
res1: Int = 113585
scala> new Foo(1, "one").hashCode
res2: Int = 113585
scala> new Foo(1, "one") == new Foo(1, "one")
res3: Boolean = true
scala> new Foo(1, "one") == new Foo(1, "one!")
res4: Boolean = false
scala> new Foo(1, "one") eq new Foo(1, "one")
res5: Boolean = false
scala> new Foo(1, "one").toString
res6: String = Foo(1,one)
scala> Set(new Foo(1, "one"), new Foo(2, "two"), new Foo(1, "one"), new Foo(2, "two"))
res7: scala.collection.immutable.Set[Foo] = Set(Foo(1,one), Foo(2,two))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment