public class ArrayListOfLong extends java.util.AbstractList<java.lang.Long> implements ListOfLong, java.util.RandomAccess, java.lang.Cloneable
| Constructor and Description |
|---|
ArrayListOfLong()
Constructs an empty list with an initial capacity of ten.
|
ArrayListOfLong(java.util.Collection<? extends java.lang.Long> c)
Constructs a list containing the elements of the specified
collection, in the order they are returned by the collection's
iterator.
|
ArrayListOfLong(int initialCapacity)
Constructs an empty list with the specified initial capacity.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(int index,
long element) |
void |
add(int index,
java.lang.Long element) |
boolean |
add(long e) |
boolean |
add(java.lang.Long e) |
boolean |
addAll(java.util.Collection<? extends java.lang.Long> c)
Appends all of the elements in the specified collection to the end of
this list, in the order that they are returned by the
specified collection's Iterator.
|
boolean |
addAll(int index,
java.util.Collection<? extends java.lang.Long> c)
Inserts all of the elements in the specified collection into this
list, starting at the specified position.
|
void |
clear()
Removes all of the elements from this list.
|
java.lang.Object |
clone()
Returns a shallow copy of this ArrayList instance.
|
boolean |
contains(java.lang.Object o)
Returns true if this list contains the specified element.
|
void |
ensureCapacity(int minCapacity)
Increases the capacity of this ArrayList instance, if
necessary, to ensure that it can hold at least the number of elements
specified by the minimum capacity argument.
|
void |
forEach(java.util.function.Consumer<? super java.lang.Long> action) |
java.lang.Long |
get(int index) |
long |
getLong(int index) |
int |
indexOf(java.lang.Object o)
Returns the index of the first occurrence of the specified element
in this list, or -1 if this list does not contain the element.
|
boolean |
isEmpty()
Returns true if this list contains no elements.
|
java.util.Iterator<java.lang.Long> |
iterator()
Returns an iterator over the elements in this list in proper sequence.
|
int |
lastIndexOf(java.lang.Object o)
Returns the index of the last occurrence of the specified element
in this list, or -1 if this list does not contain the element.
|
java.util.ListIterator<java.lang.Long> |
listIterator()
Returns a list iterator over the elements in this list (in proper
sequence).
|
java.util.ListIterator<java.lang.Long> |
listIterator(int index)
Returns a list iterator over the elements in this list (in proper
sequence), starting at the specified position in the list.
|
java.lang.Long |
remove(int index) |
boolean |
remove(java.lang.Object o) |
boolean |
removeAll(java.util.Collection<?> c)
Removes from this list all of its elements that are contained in the
specified collection.
|
boolean |
removeIf(java.util.function.Predicate<? super java.lang.Long> filter) |
boolean |
removeLong(long o) |
protected void |
removeRange(int fromIndex,
int toIndex)
Removes from this list all of the elements whose index is between
fromIndex, inclusive, and toIndex, exclusive. |
void |
replaceAll(java.util.function.UnaryOperator<java.lang.Long> operator) |
boolean |
retainAll(java.util.Collection<?> c)
Retains only the elements in this list that are contained in the
specified collection.
|
java.lang.Long |
set(int index,
java.lang.Long element)
Replaces the element at the specified position in this list with
the specified element.
|
int |
size()
Returns the number of elements in this list.
|
void |
sort(java.util.Comparator<? super java.lang.Long> c) |
java.util.Spliterator<java.lang.Long> |
spliterator()
Creates a late-binding
and fail-fast
Spliterator over the elements in this
list. |
java.util.List<java.lang.Long> |
subList(int fromIndex,
int toIndex)
Returns a view of the portion of this list between the specified
fromIndex, inclusive, and toIndex, exclusive. |
java.lang.Long[] |
toArray() |
java.lang.Long[] |
toArray(java.lang.Long[] a) |
void |
trimToSize()
Trims the capacity of this ArrayList instance to be the
list's current size.
|
public ArrayListOfLong(int initialCapacity)
initialCapacity - the initial capacity of the listjava.lang.IllegalArgumentException - if the specified initial capacity
is negativepublic ArrayListOfLong()
public ArrayListOfLong(java.util.Collection<? extends java.lang.Long> c)
c - the collection whose elements are to be placed into this listjava.lang.NullPointerException - if the specified collection is nullpublic void trimToSize()
public void ensureCapacity(int minCapacity)
minCapacity - the desired minimum capacitypublic int size()
size in interface java.util.Collection<java.lang.Long>size in interface java.util.List<java.lang.Long>size in class java.util.AbstractCollection<java.lang.Long>public boolean isEmpty()
isEmpty in interface java.util.Collection<java.lang.Long>isEmpty in interface java.util.List<java.lang.Long>isEmpty in class java.util.AbstractCollection<java.lang.Long>public boolean contains(java.lang.Object o)
contains in interface java.util.Collection<java.lang.Long>contains in interface java.util.List<java.lang.Long>contains in class java.util.AbstractCollection<java.lang.Long>o - element whose presence in this list is to be testedpublic int indexOf(java.lang.Object o)
indexOf in interface java.util.List<java.lang.Long>indexOf in class java.util.AbstractList<java.lang.Long>public int lastIndexOf(java.lang.Object o)
lastIndexOf in interface java.util.List<java.lang.Long>lastIndexOf in class java.util.AbstractList<java.lang.Long>public java.lang.Object clone()
clone in class java.lang.Objectpublic java.lang.Long[] toArray()
toArray in interface java.util.Collection<java.lang.Long>toArray in interface java.util.List<java.lang.Long>toArray in class java.util.AbstractCollection<java.lang.Long>public java.lang.Long[] toArray(java.lang.Long[] a)
public java.lang.Long get(int index)
get in interface java.util.List<java.lang.Long>get in class java.util.AbstractList<java.lang.Long>public long getLong(int index)
getLong in interface ListOfLongpublic java.lang.Long set(int index,
java.lang.Long element)
set in interface java.util.List<java.lang.Long>set in class java.util.AbstractList<java.lang.Long>index - index of the element to replaceelement - element to be stored at the specified positionjava.lang.IndexOutOfBoundsExceptionpublic boolean add(java.lang.Long e)
add in interface java.util.Collection<java.lang.Long>add in interface java.util.List<java.lang.Long>add in class java.util.AbstractList<java.lang.Long>public boolean add(long e)
add in interface ListOfLongpublic void add(int index,
java.lang.Long element)
add in interface java.util.List<java.lang.Long>add in class java.util.AbstractList<java.lang.Long>public void add(int index,
long element)
public java.lang.Long remove(int index)
remove in interface java.util.List<java.lang.Long>remove in class java.util.AbstractList<java.lang.Long>public boolean remove(java.lang.Object o)
remove in interface java.util.Collection<java.lang.Long>remove in interface java.util.List<java.lang.Long>remove in class java.util.AbstractCollection<java.lang.Long>public boolean removeLong(long o)
removeLong in interface ListOfLongpublic void clear()
clear in interface java.util.Collection<java.lang.Long>clear in interface java.util.List<java.lang.Long>clear in class java.util.AbstractList<java.lang.Long>public boolean addAll(java.util.Collection<? extends java.lang.Long> c)
addAll in interface java.util.Collection<java.lang.Long>addAll in interface java.util.List<java.lang.Long>addAll in class java.util.AbstractCollection<java.lang.Long>c - collection containing elements to be added to this listjava.lang.NullPointerException - if the specified collection is nullpublic boolean addAll(int index,
java.util.Collection<? extends java.lang.Long> c)
addAll in interface java.util.List<java.lang.Long>addAll in class java.util.AbstractList<java.lang.Long>index - index at which to insert the first element from the
specified collectionc - collection containing elements to be added to this listjava.lang.IndexOutOfBoundsExceptionjava.lang.NullPointerException - if the specified collection is nullprotected void removeRange(int fromIndex,
int toIndex)
fromIndex, inclusive, and toIndex, exclusive.
Shifts any succeeding elements to the left (reduces their index).
This call shortens the list by (toIndex - fromIndex) elements.
(If toIndex==fromIndex, this operation has no effect.)removeRange in class java.util.AbstractList<java.lang.Long>java.lang.IndexOutOfBoundsException - if fromIndex or
toIndex is out of range
(fromIndex < 0 ||
fromIndex >= size() ||
toIndex > size() ||
toIndex < fromIndex)public boolean removeAll(java.util.Collection<?> c)
removeAll in interface java.util.Collection<java.lang.Long>removeAll in interface java.util.List<java.lang.Long>removeAll in class java.util.AbstractCollection<java.lang.Long>c - collection containing elements to be removed from this listtrue if this list changed as a result of the calljava.lang.ClassCastException - if the class of an element of this list
is incompatible with the specified collection
(optional)java.lang.NullPointerException - if this list contains a null element and the
specified collection does not permit null elements
(optional),
or if the specified collection is nullCollection.contains(Object)public boolean retainAll(java.util.Collection<?> c)
retainAll in interface java.util.Collection<java.lang.Long>retainAll in interface java.util.List<java.lang.Long>retainAll in class java.util.AbstractCollection<java.lang.Long>c - collection containing elements to be retained in this listtrue if this list changed as a result of the calljava.lang.ClassCastException - if the class of an element of this list
is incompatible with the specified collection
(optional)java.lang.NullPointerException - if this list contains a null element and the
specified collection does not permit null elements
(optional),
or if the specified collection is nullCollection.contains(Object)public java.util.ListIterator<java.lang.Long> listIterator(int index)
next.
An initial call to previous would
return the element with the specified index minus one.
The returned list iterator is fail-fast.
listIterator in interface java.util.List<java.lang.Long>listIterator in class java.util.AbstractList<java.lang.Long>java.lang.IndexOutOfBoundsExceptionpublic java.util.ListIterator<java.lang.Long> listIterator()
The returned list iterator is fail-fast.
listIterator in interface java.util.List<java.lang.Long>listIterator in class java.util.AbstractList<java.lang.Long>listIterator(int)public java.util.Iterator<java.lang.Long> iterator()
The returned iterator is fail-fast.
iterator in interface java.lang.Iterable<java.lang.Long>iterator in interface java.util.Collection<java.lang.Long>iterator in interface java.util.List<java.lang.Long>iterator in class java.util.AbstractList<java.lang.Long>public java.util.List<java.lang.Long> subList(int fromIndex,
int toIndex)
fromIndex, inclusive, and toIndex, exclusive. (If
fromIndex and toIndex are equal, the returned list is
empty.) The returned list is backed by this list, so non-structural
changes in the returned list are reflected in this list, and vice-versa.
The returned list supports all of the optional list operations.
This method eliminates the need for explicit range operations (of the sort that commonly exist for arrays). Any operation that expects a list can be used as a range operation by passing a subList view instead of a whole list. For example, the following idiom removes a range of elements from a list:
list.subList(from, to).clear();
Similar idioms may be constructed for indexOf(Object) and
lastIndexOf(Object), and all of the algorithms in the
Collections class can be applied to a subList.
The semantics of the list returned by this method become undefined if the backing list (i.e., this list) is structurally modified in any way other than via the returned list. (Structural modifications are those that change the size of this list, or otherwise perturb it in such a fashion that iterations in progress may yield incorrect results.)
subList in interface java.util.List<java.lang.Long>subList in class java.util.AbstractList<java.lang.Long>java.lang.IndexOutOfBoundsExceptionjava.lang.IllegalArgumentExceptionpublic void forEach(java.util.function.Consumer<? super java.lang.Long> action)
forEach in interface java.lang.Iterable<java.lang.Long>public java.util.Spliterator<java.lang.Long> spliterator()
Spliterator over the elements in this
list.
The Spliterator reports Spliterator.SIZED,
Spliterator.SUBSIZED, and Spliterator.ORDERED.
Overriding implementations should document the reporting of additional
characteristic values.
spliterator in interface java.lang.Iterable<java.lang.Long>spliterator in interface java.util.Collection<java.lang.Long>spliterator in interface java.util.List<java.lang.Long>Spliterator over the elements in this listpublic boolean removeIf(java.util.function.Predicate<? super java.lang.Long> filter)
removeIf in interface java.util.Collection<java.lang.Long>public void replaceAll(java.util.function.UnaryOperator<java.lang.Long> operator)
replaceAll in interface java.util.List<java.lang.Long>public void sort(java.util.Comparator<? super java.lang.Long> c)
sort in interface java.util.List<java.lang.Long>