Map.Entry Interface: the getKey() and getValue() methods : Map.Entry « Collections « Java Tutorial






public Object getKey()
public Object getValue()

setValue() method allows you to replace the value for the key associated with the entry:

public Object setValue(Object newValue)
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;

public class MainClass {
  public static void main(String[] a) {
    Properties props = System.getProperties();
    Iterator iter = props.entrySet().iterator();

    while (iter.hasNext()) {
      Map.Entry entry = (Map.Entry) iter.next();
      System.out.println(entry.getKey() + " -- " + entry.getValue());
    }

  }
}
java.runtime.name -- Java(TM) 2 Runtime Environment, Standard Edition
sun.boot.library.path -- C:\Java_Dev\sdk\jdk\jre\bin
java.vm.version -- 1.5.0-b64
...








9.28.Map.Entry
9.28.1.Map.Entry Interface: the getKey() and getValue() methods