Mega Code Archive

 
Categories / Java Tutorial / Collections
 

Map Entry Interface

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 ...