Comparing elements in arrays
<p>I am stuck on one component of a java assignment for a data structures class that is preventing me from completing the rest of it. It is a simple concept but I am missing something in the implementation. I have a <code>Dynamic array</code> called <code>list1</code> and I need to compare it to another list (<code>list2</code>). I have a method: <code>equals(Object a)</code> so the call is <code>list1.equals(list2);</code></p>

<p>I know how to compare lists with an iterator but how do I reference the <code>list1</code> Object to compare the two?</p>

<p>I am not asking for you to do my assignment, just help me understand how this would work.</p>

<pre><code>public static void main(String args[]) 
    {
        DynamicArrayOfInts list1 = new DynamicArrayOfInts();        

    }   
    public DynamicArrayOfInts() 
    {
      storage = new int[INITIAL_CAPACITY]; 
      size = 0;
    }
    public boolean equals(Object aThat) 
    { 
        if(aThat.equals(storage))
            return true;
        else    
            return false;
    } 
</code></pre>
