14 Replies Latest reply on Sep 12, 2008 8:08 PM by 843785

    Finding and removing duplicates in an Arraylist of beans.


      I have an arraylist of beans from which I need to remove the duplicate entries.
      To elaborate,
      My bean has three field, name,age and indicator.
      At Present the arraylist contains duplicate entries.
      I want to get a final list in such a way that, the names are distince.If there are two beans with the same name, I want the bean with the indicator field set to Y to be inserted in the list.

      I tried copying the values from the Arraylist to a hash Set, and then rewriting to the arraylist, but this doesnt rmove the duplicates.
      Please help!!!