T - The exact type of elements held in this collectionpublic class GlueList<T> extends AbstractList<T> implements List<T>, Cloneable, Serializable
GlueList is a brand-new List implementation which is way faster than ArrayList and LinkedList. This implementation inspired from ArrayList and LinkedList working mechanism.
Nodes holding data in arrays, in the beginning the world just like ArrayList ,inserts data into array one by one when there is no space for insertion to array new Node will be created and linked with the last Node.
The array which belongs to newly created node has half of the size of list , just like ArrayList. In ArrayList when there is no space for it it creates new array with double of old size and inserts old data into new one. Unlike ArrayList GlueList does it dynamically way with creating new node so old data does NOT have to be moved to another array. You can think that GlueList is dynamic version of ArrayList.
Adding and removing operations much faster than ArrayList and LinkedList. Searching operations nearly same with ArrayList and way better than LinkedList.
Collection,
List,
LinkedList,
ArrayList,
Serialized FormmodCount| Constructor and Description |
|---|
GlueList() |
GlueList(Collection<? extends T> c) |
GlueList(int initialCapacity) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(int index,
T element) |
boolean |
add(T element) |
boolean |
addAll(Collection<? extends T> c) |
void |
clear() |
Object |
clone() |
boolean |
contains(Object o) |
T |
get(int index) |
int |
indexOf(Object o) |
boolean |
isEmpty() |
Iterator<T> |
iterator() |
int |
lastIndexOf(Object o) |
ListIterator<T> |
listIterator() |
ListIterator<T> |
listIterator(int index) |
T |
remove(int index) |
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> c) |
boolean |
retainAll(Collection<?> c) |
T |
set(int index,
T element) |
int |
size() |
List<T> |
subList(int fromIndex,
int toIndex) |
Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
void |
trimToSize() |
addAll, equals, hashCode, removeRangecontainsAll, toStringfinalize, getClass, notify, notifyAll, wait, wait, waitaddAll, containsAll, equals, hashCode, replaceAll, sort, spliteratorparallelStream, removeIf, streampublic GlueList()
public GlueList(int initialCapacity)
public GlueList(Collection<? extends T> c)
public boolean add(T element)
add in interface Collection<T>add in interface List<T>add in class AbstractList<T>public void add(int index,
T element)
public boolean addAll(Collection<? extends T> c)
addAll in interface Collection<T>addAll in interface List<T>addAll in class AbstractCollection<T>public T get(int index)
public int indexOf(Object o)
public int lastIndexOf(Object o)
lastIndexOf in interface List<T>lastIndexOf in class AbstractList<T>public boolean contains(Object o)
contains in interface Collection<T>contains in interface List<T>contains in class AbstractCollection<T>public T remove(int index)
public boolean removeAll(Collection<?> c)
removeAll in interface Collection<T>removeAll in interface List<T>removeAll in class AbstractCollection<T>public boolean retainAll(Collection<?> c)
retainAll in interface Collection<T>retainAll in interface List<T>retainAll in class AbstractCollection<T>public boolean remove(Object o)
remove in interface Collection<T>remove in interface List<T>remove in class AbstractCollection<T>public void clear()
clear in interface Collection<T>clear in interface List<T>clear in class AbstractList<T>public void trimToSize()
public Object[] toArray()
toArray in interface Collection<T>toArray in interface List<T>toArray in class AbstractCollection<T>public <T> T[] toArray(T[] a)
toArray in interface Collection<T>toArray in interface List<T>toArray in class AbstractCollection<T>public boolean isEmpty()
isEmpty in interface Collection<T>isEmpty in interface List<T>isEmpty in class AbstractCollection<T>public ListIterator<T> listIterator(int index)
listIterator in interface List<T>listIterator in class AbstractList<T>public ListIterator<T> listIterator()
listIterator in interface List<T>listIterator in class AbstractList<T>public int size()
size in interface Collection<T>size in interface List<T>size in class AbstractCollection<T>Copyright © 2022. All rights reserved.