Java Map.Entry.setValue(V value)

Syntax

Map.Entry.setValue(V value) has the following syntax.

V setValue(V value)

Example

In the following code shows how to use Map.Entry.setValue(V value) method.


import java.util.Iterator;
import java.util.Map;
/*from w ww .j a va 2  s.  co  m*/
public class Main {
  public static void main(String args[]) {
    System.out.println("PATH = " + System.getenv("PATH"));

    Map<String,String> env = System.getenv();
    for (Iterator<Map.Entry<String,String>> it = env.entrySet().iterator(); it.hasNext();) {
      Map.Entry<String,String> entry = it.next();
      entry.setValue("None");
    }
  }
}

The code above generates the following result.