Get entry set from map

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

public class Main {
  public static void main(String args[]) {
    Map<String, Double> tm = new TreeMap<String, Double>();

    tm.put("A", new Double(3.34));
    tm.put("B", new Double(1.22));
    tm.put("C", new Double(1.00));
    tm.put("D", new Double(9.22));
    tm.put("E", new Double(-1.08));

    Set<Map.Entry<String, Double>> set = tm.entrySet();

    for (Map.Entry<String, Double> me : set) {
      System.out.print(me.getKey() + ": ");
      System.out.println(me.getValue());
    }

    double balance = tm.get("A");
    tm.put("B", balance + 1000);

    System.out.println(tm.get("A"));
  }
}
  
Home 
  Java Book 
    Runnable examples  

Collection Map:
  1. Convert map to String
  2. Convert a map to a synchronized Map
  3. Get a key from value with a Map
  4. Get a set view of Keys from Map
  5. Get Size of a Map
  6. Get entry set from map
  7. Get Keys stored in an array from a map
  8. Get Values in an array from a map
  9. Is a particular key exists in Map
  10. Is a particular value exists in the Map
  11. Iterate the key value pair in a Map
  12. Iterate through the values of a Map
  13. Iterate both the keys and values of a map
  14. Remove by key from a Map
  15. Remove all values from Map