I am storing the key = "name" and value = "state" in a Hashmap. Now once I get the hashmap with all keys and values I want to iterate the hashmap and have to check whether the state(value) is running or not If the state is not running I want to print the name of that server(which is key in hashmap) Code I am using is
for(int z=0; z<=containsAll.size();z++) {
if(!containsAll.containsValue("Running")) {
System.out.println(containsAll.keySet());
}
}
Here contains all is the name of my Hashmap. Can someone help me in getting the name for which state is not running
containsAll.entrySet()). Then you check the value for the entry and if it fits your criteria you can print the key of the entry.