News »Browse Articles »
Using Generics to Store Specific Type of Objects in a HashMap
0
Using Generics to Store Specific Type of Objects in a HashMap
This example shows how to use generics to store objects in a HashMap. Before the time of generics,
one could also store specific objects in a Map but it could only be declared to contain Object instances,
without specifying what kind of objects.
And since values in a Map is stored in key / value pairs, the key was also regarded as an Object instance
The HashMap was then declared like this :
HashMap persons = new HashMap();
one could also store specific objects in a Map but it could only be declared to contain Object instances,
without specifying what kind of objects.
And since values in a Map is stored in key / value pairs, the key was also regarded as an Object instance
The HashMap was then declared like this :
HashMap persons = new HashMap();
Search News
News Categories
What's the News?
Post a link to something interesting from another site, or submit your own original writing for the Java community to read.
Most Popular News
-
How to stand out from other Java/JEE Professionals?
Published about 14-01-2009 | Rated +3 -
10 reasons IT certification will be important in 2009
Published about 05-01-2009 | Rated +2 -
The 9 hottest skills for `09
Published about 02-01-2009 | Rated +1 -
New Features in Servlets 3.0
Published about 05-01-2009 | Rated +4
Most Recent User Submitted News
- Red Hat targets Cloud Computing with next generation Java platform
Published about 02-09-2009 | Rated 0 - JBoss Tools 3.1.0.M1 for Eclipse 3.5/Galileo
Published about 11-06-2009 | Rated 0 - Ejb notes continues
Submitted by ATUL | Rated +2 - 1. Low-Level Display Access in MIDlets
Published about 14-09-2009 | Rated 0







