A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
The Mikado Method
this week in the
Agile and other Processes
Java in General
How to implemnt dupplicate key map...
Joined: Dec 03, 2008
Jan 21, 2011 03:01:15
Please can any one guide me to implement map with duplicate key?
Joined: Jan 18, 2011
Jan 21, 2011 03:15:14
I would suggest you check the following link.
Hope that helps!
Joined: Oct 13, 2005
Jan 21, 2011 03:20:08
That is a contradiction in terms. A map represents a function, and a function cannot have duplicate results from one input.
It is easy to have duplicate values.
Map<Name, Forum> moderators = new HashMap<Name, Forum>(); . . . Forum beginning = new Forum("Beginning Java"); moderators.put(new Name("Campbell Ritchie"), beginning); moderators.put(new Name("Janeice del Vecchio"), beginning)
. . . will work, but this wont't:
Map<Name, Forum> moderators = new HashMap<Name, Forum>(); . . . Forum beginning = new Forum("Beginning Java"); Forum bunkhouse = new Forum("Bunkhouse Porch"); Name campbell = new Name("Campbell Ritchie); moderators.put(campbell, beginning); moderators.put(campbell, bunkhouse)
you will ony ever get Bunkhouse Porch out of that Map.
I agree. Here's the link:
- it saves me about five hours per week
subject: How to implemnt dupplicate key map...
LinkedHashMap in html:options
Hibernate with 2 column id
Problem about EL ....
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013