jaulib v1.3.0
Jau Support Library (C++, Java, ..)
|
Hashed ArrayList implementation of the List and Collection interface. More...
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... | |
Hashed ArrayList implementation of the List and Collection interface.
Implementation properties are:
java.lang.Object#hashCode()
for O(1) operations, see below. java.util.List
functionality, ie java.util.List#indexOf(java.lang.Object)
and java.util.List#get(int)
, hence object identity can be implemented. get(java.lang.Object)
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 66 of file ArrayHashSet.java.
org.jau.util.ArrayHashSet< E >.ArrayHashSet | ( | 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 remove(E) and getOrAdd(Object) will be optimized. |
initialCapacity | use DEFAULT_INITIAL_CAPACITY for default |
loadFactor | use DEFAULT_LOAD_FACTOR for default |
Definition at line 91 of file ArrayHashSet.java.
org.jau.util.ArrayHashSet< E >.ArrayHashSet | ( | final ArrayHashSet< E > | o | ) |
Definition at line 100 of file ArrayHashSet.java.
final boolean org.jau.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
NullPointerException | if element is null but supportsNullValue() == false |
Definition at line 159 of file ArrayHashSet.java.
final void org.jau.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
IllegalArgumentException | if the given element was already contained |
NullPointerException | if element is null but supportsNullValue() == false |
Definition at line 396 of file ArrayHashSet.java.
final boolean org.jau.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.
Definition at line 226 of file ArrayHashSet.java.
final boolean org.jau.util.ArrayHashSet< E >.addAll | ( | final int | index, |
final Collection<? extends E > | c | ||
) | throws UnsupportedOperationException |
UnsupportedOperationException |
Definition at line 418 of file ArrayHashSet.java.
final void org.jau.util.ArrayHashSet< E >.clear | ( | ) |
Definition at line 141 of file ArrayHashSet.java.
final Object org.jau.util.ArrayHashSet< E >.clone | ( | ) |
Definition at line 124 of file ArrayHashSet.java.
final boolean org.jau.util.ArrayHashSet< E >.contains | ( | final Object | element | ) |
Test for containment
This is an O(1) operation.
Definition at line 246 of file ArrayHashSet.java.
final boolean org.jau.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.
Definition at line 262 of file ArrayHashSet.java.
final boolean org.jau.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.
Definition at line 553 of file ArrayHashSet.java.
final boolean org.jau.util.ArrayHashSet< E >.equals | ( | final Object | arrayHashSet | ) |
This is an O(n) operation.
Definition at line 324 of file ArrayHashSet.java.
final E org.jau.util.ArrayHashSet< E >.get | ( | final int | index | ) |
Definition at line 375 of file ArrayHashSet.java.
final E org.jau.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.
element | hash source to find the identical Object within this list |
key
hash code, or null if not contained Definition at line 505 of file ArrayHashSet.java.
final ArrayList< E > org.jau.util.ArrayHashSet< E >.getData | ( | ) |
Returns this object ordered ArrayList.
Use w/ care, it's not a copy.
Definition at line 129 of file ArrayHashSet.java.
final HashMap< E, E > org.jau.util.ArrayHashSet< E >.getMap | ( | ) |
Returns this object hash map.
Use w/ care, it's not a copy.
Definition at line 131 of file ArrayHashSet.java.
final E org.jau.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.
element | hash source to find the identical Object within this list |
key
hash code, or add the given key
and return it. NullPointerException | if element is null but supportsNullValue() == false |
Definition at line 520 of file ArrayHashSet.java.
final int org.jau.util.ArrayHashSet< E >.hashCode | ( | ) |
This is an O(n) operation over the size of this list.
java.util.List#hashCode()
, ie hashing all elements of this list. Definition at line 341 of file ArrayHashSet.java.
final int org.jau.util.ArrayHashSet< E >.indexOf | ( | final Object | element | ) |
final boolean org.jau.util.ArrayHashSet< E >.isEmpty | ( | ) |
Definition at line 346 of file ArrayHashSet.java.
final Iterator< E > org.jau.util.ArrayHashSet< E >.iterator | ( | ) |
Definition at line 351 of file ArrayHashSet.java.
final int org.jau.util.ArrayHashSet< E >.lastIndexOf | ( | final Object | o | ) |
Since this list is unique, equivalent to indexOf(java.lang.Object)
.
This is an O(n) operation.
Definition at line 466 of file ArrayHashSet.java.
final ListIterator< E > org.jau.util.ArrayHashSet< E >.listIterator | ( | ) |
Definition at line 471 of file ArrayHashSet.java.
final ListIterator< E > org.jau.util.ArrayHashSet< E >.listIterator | ( | final int | index | ) |
Definition at line 476 of file ArrayHashSet.java.
final E org.jau.util.ArrayHashSet< E >.remove | ( | final int | index | ) |
Remove element at given index from this list.
This is an O(n) operation.
Definition at line 447 of file ArrayHashSet.java.
final boolean org.jau.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).
NullPointerException | if element is null but supportsNullValue() == false |
Definition at line 191 of file ArrayHashSet.java.
final boolean org.jau.util.ArrayHashSet< E >.removeAll | ( | final Collection<?> | c | ) |
Remove all elements of given java.util.Collection
from this list.
This is an O(n) operation.
Definition at line 283 of file ArrayHashSet.java.
final boolean org.jau.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.
Definition at line 304 of file ArrayHashSet.java.
final E org.jau.util.ArrayHashSet< E >.set | ( | final int | index, |
final E | element | ||
) |
final int org.jau.util.ArrayHashSet< E >.size | ( | ) |
Definition at line 356 of file ArrayHashSet.java.
final List< E > org.jau.util.ArrayHashSet< E >.subList | ( | final int | fromIndex, |
final int | toIndex | ||
) |
Definition at line 481 of file ArrayHashSet.java.
final boolean org.jau.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.
Definition at line 114 of file ArrayHashSet.java.
final Object[] org.jau.util.ArrayHashSet< E >.toArray | ( | ) |
Definition at line 361 of file ArrayHashSet.java.
final< T > T[] org.jau.util.ArrayHashSet< E >.toArray | ( | final T[] | a | ) |
Definition at line 366 of file ArrayHashSet.java.
final ArrayList< E > org.jau.util.ArrayHashSet< E >.toArrayList | ( | ) |
Definition at line 492 of file ArrayHashSet.java.
final String org.jau.util.ArrayHashSet< E >.toString | ( | ) |
Definition at line 134 of file ArrayHashSet.java.
|
static |
The default initial capacity: {@value}.
Definition at line 76 of file ArrayHashSet.java.
|
static |
Default load factor: {@value}.
Definition at line 72 of file ArrayHashSet.java.