Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How to extract HashMap values?

Answer Posted / srikanth

package com.sri;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;

public class entry {

public static void main(String[] args) {
try{
HashMap<Integer,Integer>tm=new
HashMap<Integer,Integer>();
tm.put(100,200);
tm.put(200,101);
tm.put(600,700);
tm.put(700,103);
tm.put(900,104);
Set s=tm.entrySet();
Iterator it=s.iterator();
while(it.hasNext()){
Map.Entry me=(Map.Entry)it.next();
System.out.println(me.getKey()
+"......"+me.getValue());
}
}catch(Exception e){
e.printStackTrace();
}
}

}


Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can you declare a private method as static?

1095


What is command line argument in java?

1075


What is a prefix function.write down a code to compute prefix function.

1002


What is get () in java?

971


What is string in java is it a data type?

949


What is bytecode verifier?

878


What is the use of put method?

891


What is the best way to findout the time/memory consuming process?

973


What is toarray method in java?

1027


If goto and const is reserve words than why it is not work in java?

1914


How do you compare objects in java?

883


What are the classes of java?

918


What is entry in java?

968


How do you take thread dump in java?

942


What function extracts specified characters from a string?

949