aspose file tools*
The moose likes Beginning Java and the fly likes Collection Decalaration. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Collection Decalaration." Watch "Collection Decalaration." New topic
Author

Collection Decalaration.

Suresh Rajadurai
Ranch Hand

Joined: Feb 22, 2007
Posts: 58
Hi Gurus,

Could you please explain me the following declaration. Collection is very complicated for me.

Map<Object, ? super ArrayList> m = new LinkedHashMap<Object, ArrayList>()
What is the meaning of "?" ?

Regards

Suresh.
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

hi suresh,

see this link you will get some idea about generic collection

www.ibm.com/developerworks/java/library/j-jtp01255.html


thanks & regards,
seetharaman
Andre Brito
Ranch Hand

Joined: Dec 13, 2007
Posts: 95

The key is an Object and the



tries to polimorph it. The content can be all the subclasses of ArrayList.


I'm not very good in Generics too, but I guess is that.
Anubhav Anand
Ranch Hand

Joined: May 18, 2007
Posts: 341

The key is an Object

Yes that is true. The key for that Map object is of type Object.


tries to polimorph it. The content can be all the subclasses of ArrayList.


Unfortunately that explanation corresponds to following


But,
means that it can accept the value object as any ArrayList with a generic type that is of type ArrayList, or a supertype of ArrayList. Nothing lower in the inheritance tree can come in, but anything higher than ArrayList is OK.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Collection Decalaration.
 
Similar Threads
about generics
regarding generics
Generics Problem
Warnings during Generic assignments
Simple J2SE 5.0 Tiger Notes