This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes How to store Duplicate Element in HashSet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to store Duplicate Element in HashSet" Watch "How to store Duplicate Element in HashSet" New topic
Author

How to store Duplicate Element in HashSet

amir thakur
Greenhorn

Joined: Jul 09, 2009
Posts: 11
Heloo....

May any one tell me how to store duplicate values in HashSet...
but what i know is that HashSet does not allow duplicate values....

so please tell me how to store duplicate values in HashSet....


Thanks In Advance......
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61314
    
  66

Please take the time to choose the correct forum for your posts. This forum is for questions on HTML.

For more information, please read this.

This post has been moved to a more appropriate forum.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61314
    
  66

You use a different collection. The whole point of a Set is to not allow duplicate entries.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19697
    
  20

Use a List implementation like ArrayList instead.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
GeeCON Prague 2014
 
subject: How to store Duplicate Element in HashSet