14 Replies Latest reply: Sep 12, 2008 2:50 PM by 843785 RSS

    Finding and removing duplicates in an Arraylist of beans.

    843785
      Hi,

      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!!!

      Thanks,
      Priya