Skip to content

Instantly share code, notes, and snippets.

@steshaw
Created May 15, 2010 03:06
Show Gist options
  • Save steshaw/401968 to your computer and use it in GitHub Desktop.
Save steshaw/401968 to your computer and use it in GitHub Desktop.
scala> case class Person(name: String, age: Int)
defined class Person
scala> val p1 = Person("Steve", 39)
p1: Person = Person(Steve,39)
scala> val p2 = Person("Steve", 39)
p2: Person = Person(Steve,39)
scala> p1 == p2
res0: Boolean = true
scala> p1 === p2
<console>:10: error: value === is not a member of Person
p1 === p2
^
scala> p1 eq p2
res2: Boolean = false
scala> p1
res3: Person = Person(Steve,39)
scala> p1.toString
res4: String = Person(Steve,39)
scala> p2.toString
res5: String = Person(Steve,39)
scala> scala.collection.Set(p1, p2)
res6: scala.collection.Set[Person] = Set(Person(Steve,39))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment