Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #6265
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!nx02.iad01.newshosting.com!newshosting.com!news-out.readnews.com!news-xxxfer.readnews.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail |
|---|---|
| From | Alexis Berry <iamrichardjones@gmail.com> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Generics for a multiplevalue hashmap |
| Date | Mon, 18 Jul 2011 14:31:33 -0700 (PDT) |
| Organization | http://groups.google.com |
| Lines | 18 |
| Message-ID | <2f4c5543-ceef-4cdb-8ff7-b978f30766e0@glegroupsg2000goo.googlegroups.com> (permalink) |
| Reply-To | comp.lang.java.programmer@googlegroups.com |
| NNTP-Posting-Host | 86.30.253.4 |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-Trace | posting.google.com 1311024769 15912 127.0.0.1 (18 Jul 2011 21:32:49 GMT) |
| X-Complaints-To | groups-abuse@google.com |
| NNTP-Posting-Date | Mon, 18 Jul 2011 21:32:49 +0000 (UTC) |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=86.30.253.4; posting-account=v0qi1QoAAAAVAvWRFn4efQKvN8i9z5Sv |
| User-Agent | G2/1.0 |
| X-Google-Web-Client | true |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:6265 |
Show key headers only | View raw
Hello,
I want to create a HashMap which has a list for each key. Therefore I can store more than one value for each key. (I know this breaks the true use of a hashmap but I want a datastruture that takes one key and hold multiple value)
I thought I would be able to define:
public class MultipleValueHashMap<T, java.util.List<U>> implements Map<T, java.util.List<U>> {
....
}
I would then construct it by "new MultipleValueHashMap<Inteteger, List<String>()"
Unfortunately this does not compile. I think it might be because I am mixing generic types with real types. Am I correct?
Is there a way I can use a map to store more than one value and use generics?
Thanks
Back to comp.lang.java.programmer | Previous | Next — Next in thread | Find similar
Generics for a multiplevalue hashmap Alexis Berry <iamrichardjones@gmail.com> - 2011-07-18 14:31 -0700
Re: Generics for a multiplevalue hashmap markspace <-@.> - 2011-07-18 14:40 -0700
Re: Generics for a multiplevalue hashmap Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-07-18 21:00 -0300
Re: Generics for a multiplevalue hashmap Arne Vajhøj <arne@vajhoej.dk> - 2011-07-18 23:01 -0400
Re: Generics for a multiplevalue hashmap Roedy Green <see_website@mindprod.com.invalid> - 2011-07-19 03:59 -0700
Re: Generics for a multiplevalue hashmap Esmond Pitt <esmond.pitt@bigpond.com> - 2011-07-19 22:24 +1000
Re: Generics for a multiplevalue hashmap markspace <-@.> - 2011-07-19 08:31 -0700
csiph-web