public class HashArrayList<E> extends ArrayList<E>
ArrayList Class, which contains an additional Hashset.modCount| Constructor and Description |
|---|
HashArrayList()
Creates a new HashArrayList object.
|
HashArrayList(Collection<? extends E> c)
Creates a new HashArrayList object from a specified
Collection. |
HashArrayList(int initialCapacity)
Constructs an empty HashArrayList with the specified initial capacity.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E e)
Appends the specified
Element to the end of Arraylist and adds the specified
Element to the HashSet if it is not already present. |
void |
add(int index,
E element)
Appends the specified
Element to the specified index.Shifts the element currently at
that position (if any) and any subsequent elements to the right (adds one to their indices). |
boolean |
addAll(Collection<? extends E> c)
This implementation
iterates over the specified Collection, and adds each object
returned by the iterator to this collection, in turn. |
boolean |
addAll(int index,
Collection<? extends E> c)
This implementation
iterates over the specified Collection, and adds each object
returned by the iterator to this collection, in turn. |
void |
clear()
Removes all of the elements from this
HashArrayList. |
Object |
clone()
Clones the
HashArrayList. |
boolean |
contains(Object o)
Tests whether the
ArrayList contains the specified Object or not. |
E |
remove(int index)
Removes the Object on the specified
index. |
boolean |
remove(Object o)
Removes the Object on the specified
index. |
boolean |
removeAll(Collection<?> c)
Removes all elements contained in the specified Collection.
|
protected void |
removeRange(int fromIndex,
int toIndex)
Removes the Object on the
index within the specified range. |
E |
set(int index,
E element)
Replaces the element at the specified position in this
ArrayList with the specified element. |
ensureCapacity, forEach, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, removeIf, replaceAll, retainAll, size, sort, spliterator, subList, toArray, toArray, trimToSizeequals, hashCodecontainsAll, toStringfinalize, getClass, notify, notifyAll, wait, wait, waitcontainsAll, equals, hashCodeparallelStream, streampublic HashArrayList()
public HashArrayList(Collection<? extends E> c)
Collection.c - Collectionpublic HashArrayList(int initialCapacity)
initialCapacity - the initial capacity of the listpublic boolean add(E e)
Element to the end of Arraylist and adds the specified
Element to the HashSet if it is not already present.add in interface Collection<E>add in interface List<E>add in class ArrayList<E>e - Element, which should get appendTrueArrayList.add(java.lang.Object),
HashSet.add(java.lang.Object)public void add(int index,
E element)
Element to the specified index.Shifts the element currently at
that position (if any) and any subsequent elements to the right (adds one to their indices). Adds the specified
element to the HashSet if it is not already present.add in interface List<E>add in class ArrayList<E>index - index, where the Element should be placed toelement - Element to be appendedArrayList.add(int, java.lang.Object),
HashSet.add(java.lang.Object)public boolean addAll(Collection<? extends E> c)
iterates over the specified Collection, and adds each object
returned by the iterator to this collection, in turn. Appends the new Objects to the
end of the ArrayListaddAll in interface Collection<E>addAll in interface List<E>addAll in class ArrayList<E>c - Collectiontrue if this list changed as a result of the callArrayList.addAll(java.util.Collection),
AbstractCollection.addAll(java.util.Collection)public boolean addAll(int index,
Collection<? extends E> c)
iterates over the specified Collection, and adds each object
returned by the iterator to this collection, in turn. Inserts all of the elements in
the specified collection into the ArrayList, starting at the specified position. Shifts the element
currently at that position.addAll in interface List<E>addAll in class ArrayList<E>index - startindexc - Collectiontrue if this list changed as a result of the callArrayList.addAll(int, java.util.Collection),
AbstractCollection.addAll(java.util.Collection)public void clear()
HashArrayList. The ArrayList and the
HashSet will be empty after this call returns.clear in interface Collection<E>clear in interface List<E>clear in class ArrayList<E>ArrayList.clear(),
HashSet.clear()public Object clone()
HashArrayList.public boolean contains(Object o)
ArrayList contains the specified Object or not.contains in interface Collection<E>contains in interface List<E>contains in class ArrayList<E>o - Object to be testedTrue, if the ArrayList contains the specified ObjectArrayList.contains(java.lang.Object)public E remove(int index)
index. The ArrayList shifts any subsequent elements
to the left.Removes the element associated with the index in the Hashmap //Note: If the deleted
Object was multiple time inside the Arraylist, it could be possible that the Object is inside
ArrayList, but not in the HashSetremove in interface List<E>remove in class ArrayList<E>index - index, whose Object to be deletedHashArrayListArrayList.remove(int),
HashSet.remove(java.lang.Object)public boolean remove(Object o)
index. The ArrayList deletes the first occurrence
of the specified Object and shifts any subsequent elements to the left.Removes the element associated with the
index in the Hashmap //Note: If the deleted Object was multiple time inside the
Arraylist, it could be possible that the Object is inside ArrayList, but not in the
HashSetremove in interface Collection<E>remove in interface List<E>remove in class ArrayList<E>o - Object to be deletedHashArrayListArrayList.remove(java.lang.Object),
HashSet.remove(java.lang.Object)protected void removeRange(int fromIndex,
int toIndex)
index within the specified range. The ArrayList shifts any
subsequent elements to the left.Removes the element associated with the index in the Hashmap //Note:
If the deleted Object was multiple time inside the Arraylist, it could be possible that the Object
is inside ArrayList, but not in the HashSetremoveRange in class ArrayList<E>fromIndex - Start IndexRangetoIndex - End IndexRangeArrayList.removeRange(int, int),
HashSet.remove(java.lang.Object)public E set(int index, E element)
ArrayList with the specified element. Removes
the element associated with the index in the Hashmap and adds the element.public boolean removeAll(Collection<?> c)
removeAll in interface Collection<E>removeAll in interface List<E>removeAll in class ArrayList<E>c - Collectiontrue if this HashArrayList changed as a result of the callArrayList.removeAll(java.util.Collection),
AbstractSet.removeAll(java.util.Collection)Copyright © 2012–2026 cismet GmbH. All rights reserved.