GlueGen v2.6.0-rc-20250712
GlueGen, Native Binding Generator for Java™ (public API).
com.jogamp.common.util.ArrayHashMap< K, V > Class Template Reference

HashMap implementation backed by an ArrayList to preserve order of values. More...

Inheritance diagram for com.jogamp.common.util.ArrayHashMap< K, V >:
Collaboration diagram for com.jogamp.common.util.ArrayHashMap< K, V >:

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...
 

Detailed Description

HashMap implementation backed by an ArrayList to preserve order of values.

Implementation properties are:

O(1) operations:

  • put new key-value-pair(s)
  • test for containment
  • trying to remove non existent elements

O(n) operations:

  • put existing key-value-pair(s)
  • removing existing elements

For thread safety, the application shall decorate access to instances via com.jogamp.common.util.locks.RecursiveLock.

Definition at line 64 of file ArrayHashMap.java.

Constructor & Destructor Documentation

◆ ArrayHashMap() [1/2]

com.jogamp.common.util.ArrayHashMap< K, V >.ArrayHashMap ( final boolean  supportNullValue,
final int  initialCapacity,
final float  loadFactor 
)
Parameters
supportNullValueUse 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.
initialCapacityuse DEFAULT_INITIAL_CAPACITY for default
loadFactoruse DEFAULT_LOAD_FACTOR for default
See also
supportsNullValue()

Definition at line 89 of file ArrayHashMap.java.

◆ ArrayHashMap() [2/2]

Returns
a shallow copy of this ArrayHashMap, elements are not copied.

Definition at line 98 of file ArrayHashMap.java.

Member Function Documentation

◆ clear()

final void com.jogamp.common.util.ArrayHashMap< K, V >.clear ( )

Definition at line 152 of file ArrayHashMap.java.

◆ clone()

final Object com.jogamp.common.util.ArrayHashMap< K, V >.clone ( )

Implementation uses ArrayHashMap(ArrayHashMap).

Returns
a shallow copy of this ArrayHashMap, elements are not copied.

Definition at line 123 of file ArrayHashMap.java.

◆ containsKey()

final boolean com.jogamp.common.util.ArrayHashMap< K, V >.containsKey ( final Object  key)

Definition at line 268 of file ArrayHashMap.java.

◆ containsValue()

boolean com.jogamp.common.util.ArrayHashMap< K, V >.containsValue ( final Object  value)

Definition at line 273 of file ArrayHashMap.java.

◆ entrySet()

Set< java.util.Map.Entry< K, V > > com.jogamp.common.util.ArrayHashMap< K, V >.entrySet ( )

Definition at line 176 of file ArrayHashMap.java.

◆ equals()

final boolean com.jogamp.common.util.ArrayHashMap< K, V >.equals ( final Object  arrayHashMap)

Definition at line 278 of file ArrayHashMap.java.

◆ get()

final V com.jogamp.common.util.ArrayHashMap< K, V >.get ( final Object  key)

Definition at line 181 of file ArrayHashMap.java.

◆ getData()

final ArrayList< V > com.jogamp.common.util.ArrayHashMap< K, V >.getData ( )

Returns this object ordered ArrayList.

Use w/ care, it's not a copy.

See also
toArrayList()

Definition at line 131 of file ArrayHashMap.java.

◆ getMap()

final HashMap< K, V > com.jogamp.common.util.ArrayHashMap< K, V >.getMap ( )

Returns this object hash map.

Use w/ care, it's not a copy.

Definition at line 142 of file ArrayHashMap.java.

◆ hashCode()

final int com.jogamp.common.util.ArrayHashMap< K, V >.hashCode ( )

Definition at line 286 of file ArrayHashMap.java.

◆ isEmpty()

final boolean com.jogamp.common.util.ArrayHashMap< K, V >.isEmpty ( )

Definition at line 291 of file ArrayHashMap.java.

◆ keySet()

Set< K > com.jogamp.common.util.ArrayHashMap< K, V >.keySet ( )

Definition at line 158 of file ArrayHashMap.java.

◆ put()

final V com.jogamp.common.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).

Exceptions
NullPointerExceptionif value is null but supportsNullValue() == false

Definition at line 194 of file ArrayHashMap.java.

Here is the caller graph for this function:

◆ putAll()

void com.jogamp.common.util.ArrayHashMap< K, V >.putAll ( final Map<? extends K, ? extends V >  m)

Definition at line 229 of file ArrayHashMap.java.

Here is the call graph for this function:

◆ remove()

final V com.jogamp.common.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 244 of file ArrayHashMap.java.

◆ size()

final int com.jogamp.common.util.ArrayHashMap< K, V >.size ( )

Definition at line 296 of file ArrayHashMap.java.

◆ supportsNullValue()

final boolean com.jogamp.common.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.

See also
ArrayHashMap(boolean, int, float)

Definition at line 112 of file ArrayHashMap.java.

◆ toArrayList()

final ArrayList< V > com.jogamp.common.util.ArrayHashMap< K, V >.toArrayList ( )
Returns
a shallow copy of this ArrayHashMap's ArrayList, elements are not copied.
See also
getData()

Definition at line 137 of file ArrayHashMap.java.

◆ toString()

final String com.jogamp.common.util.ArrayHashMap< K, V >.toString ( )

Definition at line 145 of file ArrayHashMap.java.

◆ values()

Collection< V > com.jogamp.common.util.ArrayHashMap< K, V >.values ( )

See getData() and toArrayList().

See also
getData()
toArrayList()

Definition at line 171 of file ArrayHashMap.java.

Member Data Documentation

◆ DEFAULT_INITIAL_CAPACITY

final int com.jogamp.common.util.ArrayHashMap< K, V >.DEFAULT_INITIAL_CAPACITY = 16
static

The default initial capacity: {@value}.

Definition at line 74 of file ArrayHashMap.java.

◆ DEFAULT_LOAD_FACTOR

final float com.jogamp.common.util.ArrayHashMap< K, V >.DEFAULT_LOAD_FACTOR = 0.75f
static

Default load factor: {@value}.

Definition at line 70 of file ArrayHashMap.java.


The documentation for this class was generated from the following file: