HashMap loop in java

This is how you loop through the Key Value pairs in a Hashmap

Iterator iter = values.keySet().iterator();

while (iter.hasNext()) {
String key = iter.next();
String value = values.get(key);
System.out.println("Key ="+key+"\n Value"+value)
}

Here, I have implicitly assumed that values is a HashMap but as you know it can be of any Object that you like. I just used it for string and felt it might be a good example if someone is looking for it

Comments

Anonymous said…
Great article you got here. I'd like to read something more about this topic.
By the way look at the design I've made myself High class escorts
Anonymous said…
I ADAMS KEVIN, a representative of Aiico Insurance plc, we trust and respect for individual differences in day out a loan. We will provide 2% of the loan's interest rate. If you are interested in this business contact us by e-mail (adams.credi@gmail.com) now transfer their loan documents issued properly. Do you need a loan to set up business or school if you are very welcom to aiico insurance plc.you can also contact us by email(aiicco_insuranceplc@yahoo.com) we first week can request a balance transfer.

व्यक्तिगत व्यवसायका लागि ऋण चाहिन्छ? तपाईं आफ्नो इमेल संपर्क भने उपरोक्त तुरुन्तै आफ्नो ऋण स्थानान्तरण प्रक्रिया गर्न
ठीक।

Popular posts from this blog

A simple mjpeg streamer for python

How to make your window Full Screen in gnome?