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 Dynamic array
called list1
and I need to compare it to another list (list2
). I have a method: equals(Object a)
so the call is list1.equals(list2);
I know how to compare lists with an iterator but how do I reference the list1
Object to compare the two?
I am not asking for you to do my assignment, just help me understand how this would work.
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;
}