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

Hashed ArrayList implementation of the List and Collection interface. More...

Inheritance diagram for com.jogamp.common.util.ArrayHashSet< E >:
Collaboration diagram for com.jogamp.common.util.ArrayHashSet< E >:

Public Member Functions

 ArrayHashSet (final boolean supportNullValue, final int initialCapacity, final float loadFactor)
 
 ArrayHashSet (final ArrayHashSet< E > o)
 
final boolean supportsNullValue ()
 Returns true for default behavior, i.e. More...
 
final Object clone ()
 
final ArrayList< E > getData ()
 Returns this object ordered ArrayList. More...
 
final HashMap< E, E > getMap ()
 Returns this object hash map. More...
 
final String toString ()
 
final void clear ()
 
final boolean add (final E element) throws NullPointerException
 Add element at the end of this list, if it is not contained yet. More...
 
final boolean remove (final Object element) throws NullPointerException
 Remove element from this list. More...
 
final boolean addAll (final Collection<? extends E > c)
 Add all elements of given java.util.Collection at the end of this list. More...
 
final boolean contains (final Object element)
 Test for containment
This is an O(1) operation. More...
 
final boolean containsAll (final Collection<?> c)
 Test for containment of given java.util.Collection
This is an O(n) operation, over the given Collection size. More...
 
final boolean removeAll (final Collection<?> c)
 Remove all elements of given java.util.Collection from this list. More...
 
final boolean retainAll (final Collection<?> c)
 Retain all elements of the given java.util.Collection c, ie remove all elements not contained by the given java.util.Collection c. More...
 
final boolean equals (final Object arrayHashSet)
 This is an O(n) operation. More...
 
final int hashCode ()
 This is an O(n) operation over the size of this list. More...
 
final boolean isEmpty ()
 
final Iterator< E > iterator ()
 
final int size ()
 
final Object[] toArray ()
 
final< T > T[] toArray (final T[] a)
 
final E get (final int index)
 
final int indexOf (final Object element)
 
final void add (final int index, final E element) throws IllegalArgumentException, NullPointerException
 Add element at the given index in this list, if it is not contained yet. More...
 
final boolean addAll (final int index, final Collection<? extends E > c) throws UnsupportedOperationException
 
final E set (final int index, final E element)
 
final E remove (final int index)
 Remove element at given index from this list. More...
 
final int lastIndexOf (final Object o)
 Since this list is unique, equivalent to indexOf(java.lang.Object). More...
 
final ListIterator< E > listIterator ()
 
final ListIterator< E > listIterator (final int index)
 
final List< E > subList (final int fromIndex, final int toIndex)
 
final ArrayList< E > toArrayList ()
 
final E get (final Object element)
 Identity method allowing to get the identical object, using the internal hash map. More...
 
final E getOrAdd (final E element) throws NullPointerException
 Identity method allowing to get the identical object, using the internal hash map. More...
 
final boolean containsSafe (final Object element)
 Test for containment
This is an O(n) operation, using equals operation over the list. More...
 

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

Hashed ArrayList implementation of the List and Collection interface.

Implementation properties are:

O(1) operations:

  • adding new element(s)
  • test for containment
  • identity
  • trying to remove non existent elements

O(n) operations:

  • removing existing elements

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

Definition at line 68 of file ArrayHashSet.java.

Constructor & Destructor Documentation

◆ ArrayHashSet() [1/2]

com.jogamp.common.util.ArrayHashSet< E >.ArrayHashSet ( 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 remove(E) and getOrAdd(Object) will be optimized.
initialCapacityuse DEFAULT_INITIAL_CAPACITY for default
loadFactoruse DEFAULT_LOAD_FACTOR for default
See also
supportsNullValue()

Definition at line 93 of file ArrayHashSet.java.

◆ ArrayHashSet() [2/2]

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

Definition at line 102 of file ArrayHashSet.java.

Member Function Documentation

◆ add() [1/2]

final boolean com.jogamp.common.util.ArrayHashSet< E >.add ( final E  element) throws NullPointerException

Add element at the end of this list, if it is not contained yet.


This is an O(1) operation

Returns
true if the element was added to this list, otherwise false (already contained).
Exceptions
NullPointerExceptionif element is null but supportsNullValue() == false

Definition at line 161 of file ArrayHashSet.java.

Here is the caller graph for this function:

◆ add() [2/2]

final void com.jogamp.common.util.ArrayHashSet< E >.add ( final int  index,
final E  element 
) throws IllegalArgumentException, NullPointerException

Add element at the given index in this list, if it is not contained yet.


This is an O(1) operation

Exceptions
IllegalArgumentExceptionif the given element was already contained
NullPointerExceptionif element is null but supportsNullValue() == false

Definition at line 398 of file ArrayHashSet.java.

◆ addAll() [1/2]

final boolean com.jogamp.common.util.ArrayHashSet< E >.addAll ( final Collection<? extends E >  c)

Add all elements of given java.util.Collection at the end of this list.


This is an O(n) operation, over the given Collection size.

Returns
true if at least one element was added to this list, otherwise false (completely container).

Definition at line 228 of file ArrayHashSet.java.

Here is the call graph for this function:

◆ addAll() [2/2]

final boolean com.jogamp.common.util.ArrayHashSet< E >.addAll ( final int  index,
final Collection<? extends E >  c 
) throws UnsupportedOperationException
Exceptions
UnsupportedOperationException

Definition at line 420 of file ArrayHashSet.java.

◆ clear()

final void com.jogamp.common.util.ArrayHashSet< E >.clear ( )

Definition at line 143 of file ArrayHashSet.java.

◆ clone()

final Object com.jogamp.common.util.ArrayHashSet< E >.clone ( )
Returns
a shallow copy of this ArrayHashSet, elements are not copied.

Definition at line 126 of file ArrayHashSet.java.

◆ contains()

final boolean com.jogamp.common.util.ArrayHashSet< E >.contains ( final Object  element)

Test for containment
This is an O(1) operation.

Returns
true if the given element is contained by this list using fast hash map, otherwise false.

Definition at line 248 of file ArrayHashSet.java.

Here is the caller graph for this function:

◆ containsAll()

final boolean com.jogamp.common.util.ArrayHashSet< E >.containsAll ( final Collection<?>  c)

Test for containment of given java.util.Collection
This is an O(n) operation, over the given Collection size.

Returns
true if the given Collection is completly contained by this list using hash map, otherwise false.

Definition at line 264 of file ArrayHashSet.java.

Here is the call graph for this function:

◆ containsSafe()

final boolean com.jogamp.common.util.ArrayHashSet< E >.containsSafe ( final Object  element)

Test for containment
This is an O(n) operation, using equals operation over the list.


You may utilize this method to verify your hash values,
ie contains(java.lang.Object) and containsSafe(java.lang.Object) shall have the same result.

Returns
true if the given element is contained by this list using slow equals operation, otherwise false.

Definition at line 555 of file ArrayHashSet.java.

◆ equals()

final boolean com.jogamp.common.util.ArrayHashSet< E >.equals ( final Object  arrayHashSet)

This is an O(n) operation.

Returns
true if arrayHashSet is of type ArrayHashSet and all entries are equal Performance: arrayHashSet(1)

Definition at line 326 of file ArrayHashSet.java.

◆ get() [1/2]

final E com.jogamp.common.util.ArrayHashSet< E >.get ( final int  index)

Definition at line 377 of file ArrayHashSet.java.

◆ get() [2/2]

final E com.jogamp.common.util.ArrayHashSet< E >.get ( final Object  element)

Identity method allowing to get the identical object, using the internal hash map.


This is an O(1) operation.

Parameters
elementhash source to find the identical Object within this list
Returns
object from this list, identical to the given key hash code, or null if not contained

Definition at line 507 of file ArrayHashSet.java.

◆ getData()

final ArrayList< E > com.jogamp.common.util.ArrayHashSet< E >.getData ( )

Returns this object ordered ArrayList.

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

Definition at line 131 of file ArrayHashSet.java.

◆ getMap()

final HashMap< E, E > com.jogamp.common.util.ArrayHashSet< E >.getMap ( )

Returns this object hash map.

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

Definition at line 133 of file ArrayHashSet.java.

◆ getOrAdd()

final E com.jogamp.common.util.ArrayHashSet< E >.getOrAdd ( final E  element) throws NullPointerException

Identity method allowing to get the identical object, using the internal hash map.


If the element is not yet contained, add it.
This is an O(1) operation.

Parameters
elementhash source to find the identical Object within this list
Returns
object from this list, identical to the given key hash code, or add the given key and return it.
Exceptions
NullPointerExceptionif element is null but supportsNullValue() == false

Definition at line 522 of file ArrayHashSet.java.

Here is the call graph for this function:

◆ hashCode()

final int com.jogamp.common.util.ArrayHashSet< E >.hashCode ( )

This is an O(n) operation over the size of this list.

Returns
the hash code of this list as define in java.util.List#hashCode(), ie hashing all elements of this list.

Definition at line 343 of file ArrayHashSet.java.

◆ indexOf()

final int com.jogamp.common.util.ArrayHashSet< E >.indexOf ( final Object  element)

Definition at line 382 of file ArrayHashSet.java.

Here is the caller graph for this function:

◆ isEmpty()

final boolean com.jogamp.common.util.ArrayHashSet< E >.isEmpty ( )

Definition at line 348 of file ArrayHashSet.java.

◆ iterator()

final Iterator< E > com.jogamp.common.util.ArrayHashSet< E >.iterator ( )

Definition at line 353 of file ArrayHashSet.java.

◆ lastIndexOf()

final int com.jogamp.common.util.ArrayHashSet< E >.lastIndexOf ( final Object  o)

Since this list is unique, equivalent to indexOf(java.lang.Object).


This is an O(n) operation.

Returns
index of element, or -1 if not found

Definition at line 468 of file ArrayHashSet.java.

Here is the call graph for this function:

◆ listIterator() [1/2]

final ListIterator< E > com.jogamp.common.util.ArrayHashSet< E >.listIterator ( )

Definition at line 473 of file ArrayHashSet.java.

◆ listIterator() [2/2]

final ListIterator< E > com.jogamp.common.util.ArrayHashSet< E >.listIterator ( final int  index)

Definition at line 478 of file ArrayHashSet.java.

◆ remove() [1/2]

final E com.jogamp.common.util.ArrayHashSet< E >.remove ( final int  index)

Remove element at given index from this list.


This is an O(n) operation.

Returns
the removed object

Definition at line 449 of file ArrayHashSet.java.

◆ remove() [2/2]

final boolean com.jogamp.common.util.ArrayHashSet< E >.remove ( final Object  element) throws NullPointerException

Remove element from this list.


This is an O(1) operation, in case the element does not exist, otherwise O(n).

Returns
true if the element was removed from this list, otherwise false (not contained).
Exceptions
NullPointerExceptionif element is null but supportsNullValue() == false

Definition at line 193 of file ArrayHashSet.java.

◆ removeAll()

final boolean com.jogamp.common.util.ArrayHashSet< E >.removeAll ( final Collection<?>  c)

Remove all elements of given java.util.Collection from this list.


This is an O(n) operation.

Returns
true if at least one element of this list was removed, otherwise false.

Definition at line 285 of file ArrayHashSet.java.

◆ retainAll()

final boolean com.jogamp.common.util.ArrayHashSet< E >.retainAll ( final Collection<?>  c)

Retain all elements of the given java.util.Collection c, ie remove all elements not contained by the given java.util.Collection c.


This is an O(n) operation.

Returns
true if at least one element of this list was removed, otherwise false.

Definition at line 306 of file ArrayHashSet.java.

◆ set()

final E com.jogamp.common.util.ArrayHashSet< E >.set ( final int  index,
final E  element 
)

Definition at line 430 of file ArrayHashSet.java.

Here is the call graph for this function:

◆ size()

final int com.jogamp.common.util.ArrayHashSet< E >.size ( )

Definition at line 358 of file ArrayHashSet.java.

◆ subList()

final List< E > com.jogamp.common.util.ArrayHashSet< E >.subList ( final int  fromIndex,
final int  toIndex 
)

Definition at line 483 of file ArrayHashSet.java.

◆ supportsNullValue()

final boolean com.jogamp.common.util.ArrayHashSet< E >.supportsNullValue ( )

Returns true for default behavior, i.e.

null can be a valid value.

Returns false if null is not a valid value, here remove(E) and getOrAdd(Object) are optimized operations.

See also
ArrayHashSet(boolean, int, float)

Definition at line 116 of file ArrayHashSet.java.

◆ toArray() [1/2]

final Object[] com.jogamp.common.util.ArrayHashSet< E >.toArray ( )

Definition at line 363 of file ArrayHashSet.java.

◆ toArray() [2/2]

final< T > T[] com.jogamp.common.util.ArrayHashSet< E >.toArray ( final T[]  a)

Definition at line 368 of file ArrayHashSet.java.

◆ toArrayList()

final ArrayList< E > com.jogamp.common.util.ArrayHashSet< E >.toArrayList ( )
Returns
a shallow copy of this ArrayHashSet's ArrayList, elements are not copied.

Definition at line 494 of file ArrayHashSet.java.

◆ toString()

final String com.jogamp.common.util.ArrayHashSet< E >.toString ( )

Definition at line 136 of file ArrayHashSet.java.

Member Data Documentation

◆ DEFAULT_INITIAL_CAPACITY

final int com.jogamp.common.util.ArrayHashSet< E >.DEFAULT_INITIAL_CAPACITY = 16
static

The default initial capacity: {@value}.

Definition at line 78 of file ArrayHashSet.java.

◆ DEFAULT_LOAD_FACTOR

final float com.jogamp.common.util.ArrayHashSet< E >.DEFAULT_LOAD_FACTOR = 0.75f
static

Default load factor: {@value}.

Definition at line 74 of file ArrayHashSet.java.


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