tags:

views:

237

answers:

1

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

+1  A: 

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

for (String key : setOfKeys) {
    if (hm.containsKey(key)) {
        doSomething(hm, key);
    }
}
Jorge Gajon