title: Unique id for Scala object
body: <p>In Python, id(x) gives the unique id of object x. What's the equivalence in Scala?</p>
  
  <pre><code>&gt;&gt;&gt; id(True)
  1166096
  &gt;&gt;&gt; id(False)
  1166108
  &gt;&gt;&gt; x = id([1,2,3])
  &gt;&gt;&gt; id(x)
  2058589988
  &gt;&gt;&gt; y = id([1,2,3])
  &gt;&gt;&gt; id(y)
  2058589976
  </code></pre>
  
  <p>I could use x.hashCode for the id, but it will return the same value when the contents are the same. I'd like to know what makes <code>a eq b == false</code> in the following code. What values are compared in <code>a eq b</code>?</p>
  
  <pre><code>scala&gt; val a = ArrayBuffer(1,2,3)
  a: scala.collection.mutable.ArrayBuffer[Int] = ArrayBuffer(1, 2, 3)
  
  scala&gt; val b = ArrayBuffer(1,2,3)
  b: scala.collection.mutable.ArrayBuffer[Int] = ArrayBuffer(1, 2, 3)
  
  scala&gt; a.hashCode
  res44: Int = 387518613
  
  scala&gt; b.hashCode
  res45: Int = 387518613
  
  scala&gt; a eq b
  res39: Boolean = false
  </code></pre>