import java.util.*;
import java.util.Map.Entry;
public class LinkedHashMapDemo {
public static void main (String args[]){
LinkedHashMap lhm = new LinkedHashMap();
lhm.put("kapil", new Double(100.5) );
lhm.put("gaurav", new Double(200.6));
lhm.put("any", new Double(10.5));
Set> ss = lhm.entrySet();
Iterator> i =ss.iterator();
while(i.hasNext()){
Entry m = (Entry) i.next();
System.out.println("Here is key >> "+ m.getKey() );
System.out.println("Here is value >>"+ m.getValue());
}
System.out.println();
double balance = ((Double)lhm.get("kapil")).doubleValue();
lhm.put("kapil", new Double(balance + 1000));
System.out.println("kapil new balance: " +
lhm.get("kapil"));
}
}
import java.util.Map.Entry;
public class LinkedHashMapDemo {
public static void main (String args[]){
LinkedHashMap
lhm.put("kapil", new Double(100.5) );
lhm.put("gaurav", new Double(200.6));
lhm.put("any", new Double(10.5));
Set
Iterator
while(i.hasNext()){
Entry
System.out.println("Here is key >> "+ m.getKey() );
System.out.println("Here is value >>"+ m.getValue());
}
System.out.println();
double balance = ((Double)lhm.get("kapil")).doubleValue();
lhm.put("kapil", new Double(balance + 1000));
System.out.println("kapil new balance: " +
lhm.get("kapil"));
}
}
No comments:
Post a Comment