This discussion is archived
4 Replies Latest reply: Jan 2, 2011 10:34 PM by ParulGarg RSS

Removing from Arraylist

ParulGarg Explorer
Currently Being Moderated
I have an ArrayList of selectitems called newRes2 and another Arraylist of String called newentry .
I want to remove the entry in the newRes2 based on newentry .

i.e. Suppose newentry has string value "a" and newRes2 also has selectitem with the value "a" . It should remove the entry .

I tried the same by creating "SelectItem from newentry value " and then the remove method .
newRes2.remove(new SelectItem(newentry.get(i) ) ));

But since the objects are different and the output is false.

Can someone help me with this ? Do i need to over-ride equals method in this case ?

Thanks.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points