Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #6371

Re: Generics for a multiplevalue hashmap

From lewbloch <lewbloch@gmail.com>
Newsgroups comp.lang.java.programmer
Subject Re: Generics for a multiplevalue hashmap
Date 2011-07-21 15:30 -0700
Organization http://groups.google.com
Message-ID <71884899-d3c1-40e3-87a3-e184c34352b3@f17g2000prf.googlegroups.com> (permalink)
References <295b693a-1ba9-454f-965b-d33fc4d43731@glegroupsg2000goo.googlegroups.com> <4e2896da$0$309$14726298@news.sunsite.dk>

Show all headers | View raw


Arne Vajhøj wrote:
> Richard wrote:
>> I have done this
>
>> public class MultipleValueHashMap<T, U>   implements Map<T, java.util.List<U>>  {
>
>> I want to implement Map rather than extend HashMap as per Josh Bloch's Effective Java item 16.http://java.sun.com/docs/books/effective/toc.html
>
>> So I do not want to do this.
>> public class MM2<T,U>  extends HashMap<T, List<U>>   {
>> }
>
> Note the word "favor".
>
> You should evaluate not just choose without thinking.

At the very least, consider extending java.util.AbstractMap<K,V>.

--
Lew

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Find similar


Thread

Re: Generics for a multiplevalue hashmap Richard <iamrichardjones@gmail.com> - 2011-07-19 13:32 -0700
  Re: Generics for a multiplevalue hashmap Arne Vajhøj <arne@vajhoej.dk> - 2011-07-21 17:15 -0400
    Re: Generics for a multiplevalue hashmap lewbloch <lewbloch@gmail.com> - 2011-07-21 15:30 -0700

csiph-web