Example usage for java.util EnumMap getClass

List of usage examples for java.util EnumMap getClass

Introduction

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

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:de.javakaffee.kryoserializers.KryoTest.java

@Test(enabled = true)
public void testEnumMap() throws Exception {
    final EnumMap<Gender, String> map = new EnumMap<Gender, String>(Gender.class);
    final String value = "foo";
    map.put(Gender.FEMALE, value);// w  ww  .jav  a  2 s  . com
    // Another entry with the same value - to check reference handling
    map.put(Gender.MALE, value);
    @SuppressWarnings("unchecked")
    final EnumMap<Gender, String> deserialized = deserialize(serialize(map), map.getClass());
    assertDeepEquals(deserialized, map);
}