iterating thro collection and modifying

Hi,

Let me explain in brief what i'm trying to do.

i'm having a collection which has duplicate records in it.

Based on one of the field say id in each record i need to create a new collection which would have records with distinct id.

so i'm iterarating thro first collection, and creating a temporary List for new set of records. So i need to iterate thro that to check for duplicates.

I think i'm making it more complicated , and the code i have written doesnt work properly.

Can somebody help me in solving this issue. Thanks in advance.

[590 byte] By [shellava] at [2007-11-27 6:46:04]
# 1
Can you override equals appropriately? Then it's just a matter of:Set < Record > uniques = new HashSet < Record > (originalCollection);Then again, could you have started with a set?
Hippolytea at 2007-7-12 18:18:25 > top of Java-index,Java Essentials,Java Programming...
# 2
Take a look at this tutorial from Sun. http://java.sun.com/docs/books/tutorial/collections/interfaces/set.html
_helloWorld_a at 2007-7-12 18:18:25 > top of Java-index,Java Essentials,Java Programming...