public static class ReferenceBigLists.ListBigList<K> extends AbstractReferenceBigList<K> implements Serializable
AbstractReferenceBigList.ReferenceSubList<K>| Modifier and Type | Method and Description |
|---|---|
boolean |
add(K key)
Ensures that this collection contains the specified element (optional
operation).
|
void |
add(long index,
K key)
Inserts the specified element at the specified position in this big list (optional operation).
|
boolean |
addAll(Collection<? extends K> c)
Adds all of the elements in the specified collection to this collection
(optional operation).
|
boolean |
addAll(long index,
Collection<? extends K> c)
Adds all of the elements in the specified collection to this list
(optional operation).
|
void |
clear()
Removes all of the elements from this collection (optional operation).
|
boolean |
contains(Object key)
Returns true if this list contains the specified element.
|
boolean |
containsAll(Collection<?> c)
Returns true if this collection contains all of the elements
in the specified collection.
|
K |
get(long index)
Returns the element at the specified position.
|
int |
hashCode()
Returns the hash code for this big list, which is identical to
List.hashCode(). |
long |
indexOf(Object k)
Returns the index of the first occurrence of the specified element in this big list, or -1 if this big list does not contain the element.
|
boolean |
isEmpty()
Returns true if this collection contains no elements.
|
ObjectBigListIterator<K> |
iterator()
Returns an iterator over the elements contained in this collection.
|
long |
lastIndexOf(Object k)
Returns the index of the last occurrence of the specified element in this big list, or -1 if this big list does not contain the element.
|
ObjectBigListIterator<K> |
listIterator()
Returns a type-specific big-list iterator on this type-specific big list.
|
ObjectBigListIterator<K> |
listIterator(long index)
Returns a type-specific list iterator on this type-specific big list
starting at a given index.
|
K |
remove(long index)
Removes the element at the specified position.
|
boolean |
removeAll(Collection<?> c)
Removes all of this collection's elements that are also contained in the
specified collection (optional operation).
|
void |
removeElements(long from,
long to)
Removes (hopefully quickly) elements of this type-specific big list.
|
boolean |
retainAll(Collection<?> c)
Retains only the elements in this collection that are contained in the
specified collection (optional operation).
|
K |
set(long index,
K k)
Replaces the element at the specified position in this big list with the specified element (optional operation).
|
void |
size(long size)
Sets the size of this big list.
|
long |
size64()
Returns the size of this data structure as a long.
|
ReferenceBigList<K> |
subList(long from,
long to)
Returns a type-specific view of the portion of this type-specific big
list from the index
from, inclusive, to the index to,
exclusive. |
Object[] |
toArray()
Returns an array containing all of the elements in this collection.
|
<T> T[] |
toArray(T[] a)
Returns an array containing all of the elements in this collection;
the runtime type of the returned array is that of the specified array.
|
addElements, addElements, equals, getElements, peek, pop, push, size, top, toStringremoveparallelStream, remove, removeIf, spliterator, streampublic long size64()
Size64public void size(long size)
BigListIf the specified size is smaller than the current size, the last elements are
discarded. Otherwise, they are filled with 0/null/false.
public ObjectBigListIterator<K> iterator()
AbstractReferenceBigList
This implementation delegates to AbstractReferenceBigList.listIterator().
iterator in interface ObjectIterable<K>iterator in interface ReferenceBigList<K>iterator in interface ReferenceCollection<K>iterator in interface Iterable<K>iterator in interface Collection<K>iterator in class AbstractReferenceBigList<K>Iterable.iterator()public ObjectBigListIterator<K> listIterator()
AbstractReferenceBigList
Note that this specification strengthens the one given in
BigList.listIterator().
This implementation delegates to listIterator(0).
listIterator in interface BigList<K>listIterator in interface ReferenceBigList<K>listIterator in class AbstractReferenceBigList<K>BigList.listIterator()public ObjectBigListIterator<K> listIterator(long index)
AbstractReferenceBigList
Note that this specification strengthens the one given in
BigList.listIterator(long).
This implementation is based on the random-access methods.
listIterator in interface BigList<K>listIterator in interface ReferenceBigList<K>listIterator in class AbstractReferenceBigList<K>index - index of first element to be returned from the big-list iterator.BigList.listIterator(long)public boolean addAll(long index,
Collection<? extends K> c)
AbstractReferenceBigListaddAll in interface BigList<K>addAll in class AbstractReferenceBigList<K>index - index at which to insert the first element from the specified collection.c - collection containing elements to be added to this big list.true if this big list changed as a result of the callList.addAll(int, Collection)public ReferenceBigList<K> subList(long from, long to)
ReferenceBigListfrom, inclusive, to the index to,
exclusive.
Note that this specification strengthens the one given in
BigList.subList(long,long).
subList in interface BigList<K>subList in interface ReferenceBigList<K>subList in class AbstractReferenceBigList<K>from - the starting element (inclusive).to - the ending element (exclusive).BigList.subList(long,long)public boolean contains(Object key)
AbstractReferenceBigList
This implementation delegates to indexOf().
contains in interface Collection<K>contains in class AbstractReferenceBigList<K>key - element whose presence in this collection is to be testedCollection.contains(Object)public Object[] toArray()
java.util.AbstractCollectionThe returned array will be "safe" in that no references to it are maintained by this collection. (In other words, this method must allocate a new array even if this collection is backed by an array). The caller is thus free to modify the returned array.
This method acts as bridge between array-based and collection-based APIs.
This implementation returns an array containing all the elements
returned by this collection's iterator, in the same order, stored in
consecutive elements of the array, starting with index 0.
The length of the returned array is equal to the number of elements
returned by the iterator, even if the size of this collection changes
during iteration, as might happen if the collection permits
concurrent modification during iteration. The size method is
called only as an optimization hint; the correct result is returned
even if the iterator returns a different number of elements.
This method is equivalent to:
List<E> list = new ArrayList<E>(size());
for (E e : this)
list.add(e);
return list.toArray();
toArray in interface Collection<K>toArray in class AbstractCollection<K>public void removeElements(long from,
long to)
AbstractReferenceBigListThis is a trivial iterator-based implementation. It is expected that implementations will override this method with a more optimized version.
removeElements in interface ReferenceBigList<K>removeElements in class AbstractReferenceBigList<K>from - the start index (inclusive).to - the end index (exclusive).public void add(long index,
K key)
AbstractReferenceBigList
This implementation always throws an
UnsupportedOperationException.
add in interface BigList<K>add in class AbstractReferenceBigList<K>index - a position in the big list.key - an element to be inserted.List.add(int,Object)public boolean add(K key)
AbstractReferenceBigListCollections that support this operation may place limitations on what elements may be added to this collection. In particular, some collections will refuse to add null elements, and others will impose restrictions on the type of elements that may be added. Collection classes should clearly specify in their documentation any restrictions on what elements may be added.
If a collection refuses to add a particular element for any reason other than that it already contains the element, it must throw an exception (rather than returning false). This preserves the invariant that a collection always contains the specified element after this call returns.
This implementation always throws an UnsupportedOperationException.
This implementation delegates to the type-specific version of
BigList.add(long, Object).
add in interface Collection<K>add in class AbstractReferenceBigList<K>key - element whose presence in this collection is to be ensuredpublic K get(long index)
BigListget in interface BigList<K>index - a position in the big list.List.get(int)public long indexOf(Object k)
BigListindexOf in interface BigList<K>indexOf in class AbstractReferenceBigList<K>k - the object to search for.List.indexOf(Object)public long lastIndexOf(Object k)
BigListlastIndexOf in interface BigList<K>lastIndexOf in class AbstractReferenceBigList<K>k - the object to search for.List.lastIndexOf(Object)public K remove(long index)
AbstractReferenceBigList
This implementation always throws an
UnsupportedOperationException.
remove in interface BigList<K>remove in class AbstractReferenceBigList<K>index - a position in the big list.List.remove(int)public K set(long index, K k)
AbstractReferenceBigList
This implementation always throws an
UnsupportedOperationException.
set in interface BigList<K>set in class AbstractReferenceBigList<K>index - a position in the big list.k - the element to be stored at the specified position.List.set(int,Object)public boolean isEmpty()
java.util.AbstractCollectionThis implementation returns size() == 0.
isEmpty in interface Stack<K>isEmpty in interface Collection<K>isEmpty in class AbstractCollection<K>public <T> T[] toArray(T[] a)
java.util.AbstractCollectionIf this collection fits in the specified array with room to spare (i.e., the array has more elements than this collection), the element in the array immediately following the end of the collection is set to null. (This is useful in determining the length of this collection only if the caller knows that this collection does not contain any null elements.)
If this collection makes any guarantees as to what order its elements are returned by its iterator, this method must return the elements in the same order.
Like the Collection.toArray() method, this method acts as bridge between
array-based and collection-based APIs. Further, this method allows
precise control over the runtime type of the output array, and may,
under certain circumstances, be used to save allocation costs.
Suppose x is a collection known to contain only strings. The following code can be used to dump the collection into a newly allocated array of String:
String[] y = x.toArray(new String[0]);
Note that toArray(new Object[0]) is identical in function to
toArray().
This implementation returns an array containing all the elements
returned by this collection's iterator in the same order, stored in
consecutive elements of the array, starting with index 0.
If the number of elements returned by the iterator is too large to
fit into the specified array, then the elements are returned in a
newly allocated array with length equal to the number of elements
returned by the iterator, even if the size of this collection
changes during iteration, as might happen if the collection permits
concurrent modification during iteration. The size method is
called only as an optimization hint; the correct result is returned
even if the iterator returns a different number of elements.
This method is equivalent to:
List<E> list = new ArrayList<E>(size());
for (E e : this)
list.add(e);
return list.toArray(a);
toArray in interface Collection<K>toArray in class AbstractCollection<K>T - the runtime type of the array to contain the collectiona - the array into which the elements of this collection are to be
stored, if it is big enough; otherwise, a new array of the same
runtime type is allocated for this purpose.public boolean containsAll(Collection<?> c)
java.util.AbstractCollectionThis implementation iterates over the specified collection, checking each element returned by the iterator in turn to see if it's contained in this collection. If all elements are so contained true is returned, otherwise false.
containsAll in interface Collection<K>containsAll in class AbstractCollection<K>c - collection to be checked for containment in this collectionAbstractCollection.contains(Object)public boolean addAll(Collection<? extends K> c)
AbstractReferenceBigListThis implementation iterates over the specified collection, and adds each object returned by the iterator to this collection, in turn.
Note that this implementation will throw an UnsupportedOperationException unless add is overridden (assuming the specified collection is non-empty).
This implementation delegates to the type-specific version of
BigList.addAll(long, Collection).
addAll in interface Collection<K>addAll in class AbstractReferenceBigList<K>c - collection containing elements to be added to this collectionAbstractCollection.add(Object)public boolean removeAll(Collection<?> c)
java.util.AbstractCollectionThis implementation iterates over this collection, checking each element returned by the iterator in turn to see if it's contained in the specified collection. If it's so contained, it's removed from this collection with the iterator's remove method.
Note that this implementation will throw an UnsupportedOperationException if the iterator returned by the iterator method does not implement the remove method and this collection contains one or more elements in common with the specified collection.
removeAll in interface Collection<K>removeAll in class AbstractCollection<K>c - collection containing elements to be removed from this collectionAbstractCollection.remove(Object),
AbstractCollection.contains(Object)public boolean retainAll(Collection<?> c)
java.util.AbstractCollectionThis implementation iterates over this collection, checking each element returned by the iterator in turn to see if it's contained in the specified collection. If it's not so contained, it's removed from this collection with the iterator's remove method.
Note that this implementation will throw an UnsupportedOperationException if the iterator returned by the iterator method does not implement the remove method and this collection contains one or more elements not present in the specified collection.
retainAll in interface Collection<K>retainAll in class AbstractCollection<K>c - collection containing elements to be retained in this collectionAbstractCollection.remove(Object),
AbstractCollection.contains(Object)public void clear()
AbstractReferenceBigListThis implementation iterates over this collection, removing each element using the Iterator.remove operation. Most implementations will probably choose to override this method for efficiency.
Note that this implementation will throw an UnsupportedOperationException if the iterator returned by this collection's iterator method does not implement the remove method and this collection is non-empty.
This implementation delegates to AbstractReferenceBigList.removeElements(long, long).
clear in interface Collection<K>clear in class AbstractReferenceBigList<K>public int hashCode()
AbstractReferenceBigListList.hashCode().hashCode in interface Collection<K>hashCode in class AbstractReferenceBigList<K>Object.equals(java.lang.Object),
System.identityHashCode(java.lang.Object)