Skip to content

Latest commit

 

History

History
19 lines (15 loc) · 485 Bytes

map-enummap.md

File metadata and controls

19 lines (15 loc) · 485 Bytes

EnumMap<K extends Enum<K>, V>

设计亮点

key-value 使用数组代替普通的哈希表,很赞的设计。

/**
    * All of the values comprising K.  (Cached for performance.)
    */
private transient K[] keyUniverse;

/**
    * Array representation of this map.  The ith element is the value
    * to which universe[i] is currently mapped, or null if it isn't
    * mapped to anything, or NULL if it's mapped to null.
    */
private transient Object[] vals;