Q:
How to retrieve a single key out of multiple hashmaps?
I have 4 hashmaps. One of them is a string, the others are numeric. Each hashmap represents a piece of a picture.
I have no problem creating the hashmaps and putting the values I want to them.
I know that I can use the get method on a map, but how can I get a single value out of a map?
A:
It's not clear what the type of the elements are, but if they are all Strings then you can use Map#get which is a void method that will always return a String. So:
String s = map.get("key");
As a side note, it's generally better to use Map#containsKey rather than Map#get as this will throw an exception if the key isn't present rather than returning null.
All the more reason to let them lead.
When people in New Orleans first heard about the Dome exploding, they knew it would get national attention. And they knew that, in the race for political and public attention, the city's politicians would want to say the Dome blew up because of their own ineptitude.
When the Superdome blew up, nobody said that. Instead, they blamed the hurricane. They called for FEMA to get them out of the city. They blamed the National Guard for not having supplies ready in case the disaster happened. They blamed the military for not moving faster. And they told stories of how the city, to the point where no one was there, could still get their power turned on.
With no Dome to blame it on, they could only blame their own politicians. But why were they elected, after all? Why would they be in charge of a city with such a massive problem?
When they realized that no one would blame them, they started blaming it on Mayor Nagin. That was a dangerous game to play.
Before this week's Super Bowl, I heard New Orleans politicians, including Mayor Nagin, saying, "If only we had gotten a Dome. It would be a different story."
The Dome would have been a disaster. But why should the city be blamed for a problem they created? When things go wrong, the city should be held accountable for the disaster, not for the failure to have a Dome.
New Orleans had a lot of time and money to build a Dome. They used
Related links:
Commentaires