AnsweredAssumed Answered

Duplication

Question asked by c.arunrathnakumar on Apr 3, 2013
Latest reply on Apr 3, 2013 by frederikheremans1
Hi,

I m currently facing this problem. Please let me know whether the approach is correct or not.

I have 2 lists of tasks:
list1 has tasks : {Task[1001],Task[1002],Task[1003],Task[1004]}
list2 has tasks : {Task[1005],Task[1006],Task[1001],Task[1002]}

I m adding list1 to list2 : list2.addAll(list1)

Now list2 contains : {Task[1001],Task[1002],Task[1003],Task[1004],Task[1005],Task[1006],Task[1001],Task[1002]}

I create a set with list2 :

Set<Task> tasksSet = new HashSet<Task>(list2);    //Imagining that the duplicates would be removed

tasksSet still contains the entries of list2, without removing the duplicates. :?  :?  :?



Can anybody help me?


Thanks,
Arun…

Outcomes