Question

I have a Hashmap and a set of keys. For each key, I want to perform a task depending on whether or not it is present in the hashmap. Can someone show be a way to do this? I'm using Struts and JSPs in my application

Was it helpful?

Solution

This question is old, but, were you trying to do something like this?:

for (String key : setOfKeys) {
    if (hm.containsKey(key)) {
        doSomething(hm, key);
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top