• Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting typeof value put in the HashMap  RSS feed

 
Jignesh Gohel
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

How can i get the type of value put in the Hashmap.That is suppose

if i am putting a double value like this:

Double doub = new double("1.5");
hashmap.put("1",doub);


Now in some other class while getting the key's value using hashMap.get("1"), first i want to check the type of the value.

So how can i do that??

Thanks,
Jignesh
 
Ajay A Patil
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As follows:

 
Paul Clapham
Sheriff
Posts: 22841
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
However if you have a design that involves objects of different types as values in a Hashmap, you ought to reconsider that design.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!