How to extract HashMap values?

Answer Posted / siddpany

class hashMap
{
public static void main(String args[])
{
HashMap map = new HashMap();
map.put("key1",200);
map.put("key1",100);
map.put("key1",400);
map.put("key1",700);
Set set = map.keySet();
//for each loop
for(Object object :set)
{
System.out.println(map.get(Object));
}

Is This Answer Correct ?    11 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

why java uses class level type casting ?

2335


What are different types of inner classes ?

647


Make a data structure and implement an algorithm to print all the files in a directory. (The root directory can have sub-directories too.)

955


What lambda means?

632


What is the difference between method and means?

665






Can we execute a program without main?

625


How do you find the absolute value?

663


How is hashcode calculated in java?

590


Explain parallel processing in java8?

749


What is array length?

582


Why can't you declare a class as protected?

693


What are runtime exceptions?

726


How to use arraylist in java netbeans?

605


What is a static class in java?

633


How many bytes are a float?

598