Example usage for java.util EnumMap equals

List of usage examples for java.util EnumMap equals

Introduction

In this page you can find the example usage for java.util EnumMap equals.

Prototype

private boolean equals(EnumMap<?, ?> em) 

Source Link

Usage

From source file:Tutorial.java

public static void main(String[] args) {
    EnumMap<Tutorial, String> map1 = new EnumMap<Tutorial, String>(Tutorial.class);
    EnumMap<Tutorial, String> map2 = new EnumMap<Tutorial, String>(Tutorial.class);

    map1.put(Tutorial.CSS, "1");
    map1.put(Tutorial.Python, "2");
    map1.put(Tutorial.PHP, "3");
    map1.put(Tutorial.Java, "4");

    map2.put(Tutorial.CSS, "1");
    map2.put(Tutorial.Python, "2");
    map2.put(Tutorial.PHP, "3");
    map2.put(Tutorial.Java, "4");

    System.out.println("map1:" + map1);
    System.out.println("map2:" + map2);

    boolean equal = map1.equals(map2);

    System.out.println("Map1 and map 2 are equal:" + equal);

    map2.put(Tutorial.Javascript, "5");

    equal = map1.equals(map2);//from w  w  w  .  j  a v  a2 s.  c  o  m

    System.out.println("Map1 and map 2 are equal:" + equal);
}