![]() |
|
|
|
#1 |
|
Hi,
I know that having duplicate keys in a map is not possible, but is there anything in java that can do such a thing? example; key1 - "one" - "1" - "uno" key2 - "two" - "2" - "ect" so by using key2 I can access all the data (return an enumeration ect) associated with key2. thanks in advance lee -- Posted via NewsDemon.com - Premium Uncensored Newsgroup Service ------->>>>>>http://www.NewsDemon.com<<<<<<------ Unlimited Access, Anonymous Accounts, Uncensored Broadband Access L Clarke |
|
|
|
|
#2 |
|
Posts: n/a
|
L Clarke wrote:
> Hi, > > I know that having duplicate keys in a map is not possible, but is there > anything in java that can do such a thing? > > example; > > key1 > - "one" > - "1" > - "uno" > > key2 > - "two" > - "2" > - "ect" > > so by using key2 I can access all the data (return an enumeration ect) > associated with key2. > > thanks in advance > lee > > > > -- > Posted via NewsDemon.com - Premium Uncensored Newsgroup Service > ------->>>>>>http://www.NewsDemon.com<<<<<<------ > Unlimited Access, Anonymous Accounts, Uncensored Broadband Access It is Map of Maps key="key1", value - another map where keys are "one", "1", "uno", "один", "ieden", ... Vova Reznik |
|
|
|
#3 |
|
Posts: n/a
|
L Clarke wrote:
> Hi, > > I know that having duplicate keys in a map is not possible, but is there > anything in java that can do such a thing? > > example; > > key1 > - "one" > - "1" > - "uno" > > key2 > - "two" > - "2" > - "ect" > > so by using key2 I can access all the data (return an enumeration ect) > associated with key2. > > thanks in advance > lee > > > > -- > Posted via NewsDemon.com - Premium Uncensored Newsgroup Service > ------->>>>>>http://www.NewsDemon.com<<<<<<------ > Unlimited Access, Anonymous Accounts, Uncensored Broadband Access sure... have a map of arrayList objects Andrew McDonagh |
|
|
|
#4 |
|
Posts: n/a
|
L Clarke wrote: > Hi, > > I know that having duplicate keys in a map is not possible, but is there > anything in java that can do such a thing? > > example; > > key1 > - "one" > - "1" > - "uno" > > key2 > - "two" > - "2" > - "ect" > > so by using key2 I can access all the data (return an enumeration ect) > associated with key2. > > thanks in advance > lee You could have a map where the value is a datastructure that holds an indeterminate amount of values. Or you could (ab)use a hashmap in ways no hashmap should be (ab)used. Scott.R.Lemke@gmail.com |
|
|
|
#5 |
|
Posts: n/a
|
L Clarke wrote:
> I know that having duplicate keys in a map is not possible, but is there > anything in java that can do such a thing? http://java.sun.com/docs/books/tutor...faces/map.html Scroll down to the section on Multimaps. Jeffrey Schwab |
|
|
|
#6 |
|
Posts: n/a
|
L Clarke wrote:
> I know that having duplicate keys in a map is not possible, but is there > anything in java that can do such a thing? > > example; > > key1 > - "one" > - "1" > - "uno" > > key2 > - "two" > - "2" > - "ect" > > so by using key2 I can access all the data (return an enumeration ect) > associated with key2. Just use an ArrayList as the value in the Hash, then you iterate the AL when its returned. /tom tom fredriksen |
|
|
|
#7 |
|
Posts: n/a
|
On Wed, 22 Feb 2006 20:30:20 -0000, "L Clarke" <>
wrote, quoted or indirectly quoted someone who said : >I know that having duplicate keys in a map is not possible, but is there >anything in java that can do such a thing? sure a HashMap where the value is an array or ArrayList of the duplicate values. When you discover the dup, you have to manage it yourself by adding your element to the array/ArrayList/Collection HashMap just hands you back the list of duplicates. -- Canadian Mind Products, Roedy Green. http://mindprod.com Java custom programming, consulting and coaching. Roedy Green |
|
|
|
#8 |
|
Posts: n/a
|
Jeffrey Schwab wrote:
> L Clarke wrote: > >> I know that having duplicate keys in a map is not possible, but is >> there anything in java that can do such a thing? > > > http://java.sun.com/docs/books/tutor...faces/map.html > > Scroll down to the section on Multimaps. They mention it, jakarta common collections DOES it: http://jakarta.apache.org/commons/co.../MultiMap.html BugBear bugbear |
|
![]() |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Change keys of keyboard as what you like. | geraldmapa | Software | 0 | 06-30-2009 09:02 AM |
| DVD Verdict reviews: THE DIARY OF ALICIA KEYS, A NEW KIND OF LOVE, and more! | DVD Verdict | DVD Video | 0 | 02-15-2005 10:20 AM |
| duplicate files | -D- | A+ Certification | 0 | 02-22-2004 01:02 AM |
| Here's a list of Keyboard Shortcuts and Hot keys | Sean Cleary | A+ Certification | 0 | 08-04-2003 03:51 AM |
| Dos Keys, Window Keys, is there a list of what I must memorize | Sean Cleary | A+ Certification | 0 | 08-04-2003 03:03 AM |