HashMaps - Fish-In-A-Suit/Conquest GitHub Wiki
Introduction
A Map is an associative array data structure: key1 is associated with value1, key2 with value2, key3 with value3 and so on. This way you can store values at specified keys, which can later be used to retireve correspinding values.
A HashMap is one of the implementations of the Map interface. It is based on a technoque called hashing. Hashing refers to the transformation of a string of characters (text or an object) to a shortened, fixed-length values that represent the original string. A shorter value helps in indexing and faster searches.
Constructors & methods
HashMap()
: constructs a default HashMapHashMap(Map m)
: initializes the hash map by using the elements opf the given Map object mHashMap(int capacity)
: initializes the capacity of the hash map to the given integer value capacity
void clear()
: removes all mappingsObject clone()
: returns of copy of this HashMap instance without cloning the keys and values - "a shallow copy"boolean containsKey(Object key)
: returns true if this map contains a mapping for the specified keyboolean containsValue(Object value)
: returns true if this map maps one or more keys to the specified valueObject get(Object key)
: returns the value to which the specified key is mapped in this identity hash map, or null if the map contains no mapping for this keyboolean isEmpty
: returns true if this map contains no key-value mappingsObject put(Object key, Object value)
: associates the specified value with the specified key in this mapObject remove(Object key)
: removes the mapping for this key from this map if presentint size()
: returns the number of key-value mappings in this map
some more methods regarding Collections and Sets