Java object comparison and Hashtable with Object keys
<p>Suppose I have an <code>MyObject</code> class, and it's stored in 2 different <code>ArrayList</code>. If get the same object from the 2 ArrayList, how would I compare them to check if they're identical?</p>

<p>Would I do <code>instance1 == instance2</code> or <code>instance1.equals(instance2)</code>? I'm pretty sure the == operator looks at the pointer location, but if I get instance1 from array1 and instance2 from array2, would they return different pointer locations or the same?</p>

<p>Same thing with Hashtable: Does it store a pointer location as the key or the actual object? If I have 2 objects with identical content but are actually different objects, would it still work?</p>

<p>Thanks</p>
