Java EnumMap is a Java Map that uses keys of a single enum type. EnumMap utilizes the inherent associative nature of arrays and is therefore the most efficient implementation of Map. In a nutshell, EnumMap is a one-trick-pony designed to be used when the keys of your Map are constants and therefore can be made static and final. Constructors of EnumMap… Continue reading Java EnumMap with Example
Tag: Map Interface
Java HashMap with Example
Java HashMap is the most popular concrete implementation of Java Map. The distinguishing feature of HashMap is that it is based on the celebrated hashtable data structure. Like any other Java Map, a HashMap maintains associations between keys and values. A HashMap is an unordered collection, meaning you should not use HashMap if your program requires iteration or retrieval in a predictable order. Nevertheless, a HashMap is extremely efficient… Continue reading Java HashMap with Example
Java Map
A Java Map is an aggregation of values, each of which is associated with exactly one key. The distinguishing feature of a Java Map is that keys are unique and every key is associated with a value. The same value may be associated with two keys but two values can’t have the same key. A key maps to exactly one… Continue reading Java Map