mardi 21 juillet 2020

Getting key value for Hashmap with If condition

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

Aucun commentaire:

Enregistrer un commentaire