Java Map.Entry.equals(Object o)

Syntax

Map.Entry.equals(Object o) has the following syntax.

boolean equals(Object o)

Example

In the following code shows how to use Map.Entry.equals(Object o) method.


import java.util.Iterator;
import java.util.Map;
/*w ww . ja v a 2  s  . c om*/
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();
      System.out.println(entry.equals(entry));
    }
  }
}

The code above generates the following result.