jaulib v1.3.0
Jau Support Library (C++, Java, ..)
|
HashMap
implementation backed by an ArrayList
to preserve order of values.
More...
Public Member Functions | |
ArrayHashMap (final boolean supportNullValue, final int initialCapacity, final float loadFactor) | |
ArrayHashMap (final ArrayHashMap< K, V > o) | |
final boolean | supportsNullValue () |
Returns true for default behavior, i.e. More... | |
final Object | clone () |
Implementation uses ArrayHashMap(ArrayHashMap) . More... | |
final ArrayList< V > | getData () |
Returns this object ordered ArrayList. More... | |
final ArrayList< V > | toArrayList () |
final HashMap< K, V > | getMap () |
Returns this object hash map. More... | |
final String | toString () |
final void | clear () |
Set< K > | keySet () |
Collection< V > | values () |
Set< java.util.Map.Entry< K, V > > | entrySet () |
final V | get (final Object key) |
final V | put (final K key, final V value) throws NullPointerException |
void | putAll (final Map<? extends K, ? extends V > m) |
final V | remove (final Object key) |
final boolean | containsKey (final Object key) |
boolean | containsValue (final Object value) |
final boolean | equals (final Object arrayHashMap) |
final int | hashCode () |
final boolean | isEmpty () |
final int | size () |
Static Public Attributes | |
static final float | DEFAULT_LOAD_FACTOR = 0.75f |
Default load factor: {@value}. More... | |
static final int | DEFAULT_INITIAL_CAPACITY = 16 |
The default initial capacity: {@value}. More... | |
HashMap
implementation backed by an ArrayList
to preserve order of values.
Implementation properties are:
java.lang.Object#hashCode()
for O(1) operations, see below. O(1) operations:
O(n) operations:
For thread safety, the application shall decorate access to instances via jau.test.util.parallel.locks.RecursiveLock
.
Definition at line 62 of file ArrayHashMap.java.
org.jau.util.ArrayHashMap< K, V >.ArrayHashMap | ( | final boolean | supportNullValue, |
final int | initialCapacity, | ||
final float | loadFactor | ||
) |
supportNullValue | Use true for default behavior, i.e. null can be a valid value. Use false if null is not a valid value, here put(Object, Object) and remove(Object) will be optimized. |
initialCapacity | use DEFAULT_INITIAL_CAPACITY for default |
loadFactor | use DEFAULT_LOAD_FACTOR for default |
Definition at line 87 of file ArrayHashMap.java.
org.jau.util.ArrayHashMap< K, V >.ArrayHashMap | ( | final ArrayHashMap< K, V > | o | ) |
Definition at line 96 of file ArrayHashMap.java.
final void org.jau.util.ArrayHashMap< K, V >.clear | ( | ) |
Definition at line 150 of file ArrayHashMap.java.
final Object org.jau.util.ArrayHashMap< K, V >.clone | ( | ) |
Implementation uses ArrayHashMap(ArrayHashMap)
.
Definition at line 121 of file ArrayHashMap.java.
final boolean org.jau.util.ArrayHashMap< K, V >.containsKey | ( | final Object | key | ) |
Definition at line 266 of file ArrayHashMap.java.
boolean org.jau.util.ArrayHashMap< K, V >.containsValue | ( | final Object | value | ) |
Definition at line 271 of file ArrayHashMap.java.
Set< java.util.Map.Entry< K, V > > org.jau.util.ArrayHashMap< K, V >.entrySet | ( | ) |
Definition at line 174 of file ArrayHashMap.java.
final boolean org.jau.util.ArrayHashMap< K, V >.equals | ( | final Object | arrayHashMap | ) |
Definition at line 276 of file ArrayHashMap.java.
final V org.jau.util.ArrayHashMap< K, V >.get | ( | final Object | key | ) |
Definition at line 179 of file ArrayHashMap.java.
final ArrayList< V > org.jau.util.ArrayHashMap< K, V >.getData | ( | ) |
Returns this object ordered ArrayList.
Use w/ care, it's not a copy.
Definition at line 129 of file ArrayHashMap.java.
final HashMap< K, V > org.jau.util.ArrayHashMap< K, V >.getMap | ( | ) |
Returns this object hash map.
Use w/ care, it's not a copy.
Definition at line 140 of file ArrayHashMap.java.
final int org.jau.util.ArrayHashMap< K, V >.hashCode | ( | ) |
Definition at line 284 of file ArrayHashMap.java.
final boolean org.jau.util.ArrayHashMap< K, V >.isEmpty | ( | ) |
Definition at line 289 of file ArrayHashMap.java.
Set< K > org.jau.util.ArrayHashMap< K, V >.keySet | ( | ) |
Definition at line 156 of file ArrayHashMap.java.
final V org.jau.util.ArrayHashMap< K, V >.put | ( | final K | key, |
final V | value | ||
) | throws NullPointerException |
This is an O(1) operation, in case the key does not exist, otherwise O(n).
NullPointerException | if value is null but supportsNullValue() == false |
Definition at line 192 of file ArrayHashMap.java.
void org.jau.util.ArrayHashMap< K, V >.putAll | ( | final Map<? extends K, ? extends V > | m | ) |
final V org.jau.util.ArrayHashMap< K, V >.remove | ( | final Object | key | ) |
This is an O(1) operation, in case the key does not exist, otherwise O(n).
Definition at line 242 of file ArrayHashMap.java.
final int org.jau.util.ArrayHashMap< K, V >.size | ( | ) |
Definition at line 294 of file ArrayHashMap.java.
final boolean org.jau.util.ArrayHashMap< K, V >.supportsNullValue | ( | ) |
Returns true
for default behavior, i.e.
null
can be a valid value.
Returns false
if null
is not a valid value, here put(Object, Object)
and remove(Object)
are optimized operations.
Definition at line 110 of file ArrayHashMap.java.
final ArrayList< V > org.jau.util.ArrayHashMap< K, V >.toArrayList | ( | ) |
Definition at line 135 of file ArrayHashMap.java.
final String org.jau.util.ArrayHashMap< K, V >.toString | ( | ) |
Definition at line 143 of file ArrayHashMap.java.
Collection< V > org.jau.util.ArrayHashMap< K, V >.values | ( | ) |
See getData()
and toArrayList()
.
Definition at line 169 of file ArrayHashMap.java.
|
static |
The default initial capacity: {@value}.
Definition at line 72 of file ArrayHashMap.java.
|
static |
Default load factor: {@value}.
Definition at line 68 of file ArrayHashMap.java.