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 we modify the throws clause of the superclass method while overriding it in the subclass?

1032


What is constructor and virtual function? Can we call a virtual function in a constructor?

1142


Give me some null interfaces in java?

1053


What is serialversionuid?

1089


Why strings in java are called as immutable?

988


What is sortedmap in java?

1029


Can we override the static method?

1029


Explain listiterator and methods in listiterator?

1016


What types of index data structures can you have in java?

1231


What is supplier in java?

1002


What is meant by flickering?

1081


When can you say a graph to be a tree?

1083


What are the data types supported by java? What is autoboxing and unboxing?

1019


Which collection allows duplicate values in java?

971


What is array and arraylist in java?

1105