ADD THIS METHOD:
public boolean equals (IntSet otherSet)
-returns true or false as this set and otherSet contain the same elements or not
Can someone explain to me what to do here? I don't even know where to start. Professor says I should pass IntSet, but shouldn't it be the ArrayList I created instead? Someone help me please!
Here is what I have so far:
import java.util.*;
public class IntSet
{
private ArrayList<Integer> list;
public IntSet()
{
list = new ArrayList<Integer>();
}
public boolean in(int e)
{
int i = list.indexOf(e);
if(i >= 0)
{
return true;
}
else
{
return false;
}
}
public void insert(int e)
{
list.add(e);
}
public void remove(int e)
{
list.remove(e);
}
public IntSet compare (IntSet otherSet)
{
}
}
This post has been edited by mattlyons: 26 September 2009 - 08:27 PM

New Topic/Question
Reply




MultiQuote





|