Example usage for java.util EnumMap clone

List of usage examples for java.util EnumMap clone

Introduction

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

Prototype

@SuppressWarnings("unchecked")
public EnumMap<K, V> clone() 

Source Link

Document

Returns a shallow copy of this enum map.

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");

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

    map2 = map1.clone();

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