Reusable Java library of general tools with minimal external dependencies.
For questions or support, please contact us:
Email: support@aoindustries.com
Phone: 1-800-519-9541
Phone: +1-251-607-9556
Web: https://www.aoindustries.com/contact
public class SortedArrayList<E> extends ArrayList<E>
SortedArrayList stores its elements in hashCode order and provides means of quickly
locating objects.modCount| Constructor and Description |
|---|
SortedArrayList()
Constructs an empty list with an initial capacity of ten.
|
SortedArrayList(int initialCapacity)
Constructs an empty list with the specified initial capacity.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E o)
Adds the specified element in sorted position within this list.
|
void |
add(int index,
E element)
Not allowed to add to specific indexes.
|
boolean |
addAll(Collection<? extends E> c)
Adds all of the elements in the specified Collection and sorts during
the add.
|
boolean |
addAll(int index,
Collection<? extends E> c)
Not allowed to add to a specific index.
|
protected int |
binarySearchHashCode(int elemHash)
Performs a binary search on hashCode values only.
|
int |
indexOf(int hashCode)
Finds the first index where the object has the provided hashCode
|
int |
indexOf(Object elem)
Searches for the first occurrence of the given argument, testing
for equality using the equals method.
|
int |
lastIndexOf(Object elem)
Returns the index of the last occurrence of the specified object in
this list.
|
boolean |
remove(Object o)
Removes a single instance of the specified element from this
list, if it is present (optional operation).
|
E |
set(int index,
E element)
Not allowed to set specific indexes.
|
clear, clone, contains, ensureCapacity, forEach, get, isEmpty, iterator, listIterator, listIterator, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, size, sort, spliterator, subList, toArray, toArray, trimToSizeequals, hashCodecontainsAll, toStringfinalize, getClass, notify, notifyAll, wait, wait, waitcontainsAll, equals, hashCodeparallelStream, streampublic SortedArrayList(int initialCapacity)
initialCapacity - the initial capacity of the list.IllegalArgumentException - if the specified initial capacity
is negativepublic SortedArrayList()
protected int binarySearchHashCode(int elemHash)
public int indexOf(Object elem)
public int indexOf(int hashCode)
public int lastIndexOf(Object elem)
lastIndexOf in interface List<E>lastIndexOf in class ArrayList<E>elem - the desired element.public boolean add(E o)
public void add(int index,
E element)
public boolean remove(Object o)
public boolean addAll(Collection<? extends E> c)
Copyright © 2000–2016 AO Industries, Inc.. All rights reserved.