| Author |
Hashcode not removing duplicates from set
|
Bud Tippins
Ranch Hand
Joined: Jan 28, 2011
Posts: 52
|
|
I have the following code. Lines 61 through 67 are supposed to be removing the duplicates from the list of titles coming from the file. However when I run this in NetBeans the duplicates appear. What do I need to do to have the duplicates removed?
Thank you for your help.
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12911
|
|
Note that you are printing the songs three times: in lines 25, 27 and 32.
I guess that in line 32 you meant to print songSet, but you are printing songList. You're not printing the content of the HashSet anywhere.
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
Bud Tippins
Ranch Hand
Joined: Jan 28, 2011
Posts: 52
|
|
|
Jesper, Thanks for your help. That was the problem.
|
 |
 |
|
|
subject: Hashcode not removing duplicates from set
|
|
|