This week's book giveaway is in the
We're giving away four copies of a choice of
"Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac"
and have Joe Kissell on-line!
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Take Control of Upgrading to Yosemite
Take Control of Automating Your Mac
this week in the
How to find the value for a particular key in a Hashmap
Joined: May 12, 2008
Jul 13, 2009 14:32:09
I have a hashmap that contains Strings (keys) and Dates (values).
Sample hashmap is:
If a variable containing "5100" is passed in, I want to get "2009-06-29".
author and iconoclast
Joined: Jul 08, 2003
Jul 13, 2009 14:40:26
So if your map is in variable "map", and "5100" is in variable "key", then result becomes "2009-06-29":
result = map.get(key);
[Jess in Action]
Joined: Jun 09, 2009
Jul 13, 2009 14:53:34
is returning actual Java Date objects, then you need:
Date result = map.get(key);
Otherwise you will get a class cast exception (and if your
is using generics, you would get a compile time exception).
Check out the
subject: How to find the value for a particular key in a Hashmap
Get timestamp difference in hours and minutes
Problem starting JBOSS 4.2.3
JMSCI listener problem in JBOSS 4.2.3
SSL Handshake in SSO
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014