<br><br><div class="gmail_quote">On Wed, Sep 30, 2009 at 10:12 PM, Robert Poor <span dir="ltr">&lt;<a href="mailto:rdpoor@gmail.com">rdpoor@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<br>
So what I&#39;ll probably end up doing is to create a unique ID for each of my objects (either via toString() or some other construction-time device), and keeping the objects sorted in an array using the ID for a binary search function.  It&#39;s not as fast as a hashmap, but it&#39;s faster than linear search.<br>

<br>
- rob<br></blockquote></div><br>Hmm, toString() (giving the memory pointer thingie) won&#39;t work if you want to be able to create two equal objects and use them like:<br><br>A x1;<br>&quot;x&quot; =&gt; <a href="http://x1.id">x1.id</a>;<br>
hashset.put(x1);<br>A y;<br>&quot;y&quot; =&gt; <a href="http://y.id">y.id</a>;<br>hashset.put(y);<br>A x2;<br>&quot;x&quot; =&gt; <a href="http://x2.id">x2.id</a>; // same as x1<br>if (hashset.contains(x2)) {<br>    // You want this code to run here<br>
}<br><br clear="all"><br>-- <br>Release me, insect, or I will destroy the Cosmos!<br>