Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: markspace <-@.> Newsgroups: comp.lang.java.programmer Subject: Re: Generics for a multiplevalue hashmap Date: Tue, 19 Jul 2011 08:31:08 -0700 Organization: A noiseless patient Spider Lines: 21 Message-ID: References: <2f4c5543-ceef-4cdb-8ff7-b978f30766e0@glegroupsg2000goo.googlegroups.com> <4e257763$0$46572$c30e37c6@exi-reader.telstra.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 19 Jul 2011 15:31:10 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="XjIWM99mD7Ijfdu600oVPA"; logging-data="3954"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19n8BWAz7aPOKRqR7xz2ljQ7VxZRRfD2YQ=" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20110624 Thunderbird/5.0 In-Reply-To: <4e257763$0$46572$c30e37c6@exi-reader.telstra.net> Cancel-Lock: sha1:hNNuGlj8VNnQAY01oMwEOu06oho= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:6291 On 7/19/2011 5:24 AM, Esmond Pitt wrote: > On 19/07/2011 7:31 AM, Alexis Berry wrote: >> public class MultipleValueHashMap> implements >> Map> { > > public class MultipleValueHashMap>> > implements Map ? Well, this doesn't work for a couple of reasons. First, in terms of syntax, you still have to declare U as a type parameter: public class GenericTest> extends AbstractMap> { Secondly, "List" here is both an input and and output. And going by PECS -- Producer Extends, Consumer Super -- you can't use just one. So I think the default is just to try to get the right type there (List works) and be careful with your type declarations.