public abstract class AbstractReferenceBigList<K> extends it.unimi.dsi.fastutil.objects.AbstractReferenceCollection<K> implements ReferenceBigList<K>, it.unimi.dsi.fastutil.Stack<K>
Most of the methods in this class are optimized with the assumption that the List will have
have constant-time random access. If this is not the case, you
should probably at least override listIterator(long) and the xAll() methods
(such as addAll(long, java.util.Collection<? extends K>)) with a more appropriate iteration scheme. Note the subList(long, long)
method is cognizant of random-access or not, so that need not be reimplemented.
| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractReferenceBigList.ReferenceRandomAccessSubList<K> |
static class |
AbstractReferenceBigList.ReferenceSubList<K>
A class implementing a sublist view.
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractReferenceBigList() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(K k) |
void |
add(long index,
K k) |
boolean |
addAll(java.util.Collection<? extends K> c) |
boolean |
addAll(long index,
java.util.Collection<? extends K> c)
Adds all of the elements in the specified collection to this list (optional operation).
|
void |
addElements(long index,
K[][] a)
Add (hopefully quickly) elements to this type-specific big list.
|
void |
addElements(long index,
K[][] a,
long offset,
long length)
Add (hopefully quickly) elements to this type-specific big list.
|
void |
clear() |
boolean |
contains(java.lang.Object k)
Returns true if this list contains the specified element.
|
protected void |
ensureIndex(long index)
Ensures that the given index is nonnegative and not greater than this big-list size.
|
protected void |
ensureRestrictedIndex(long index)
Ensures that the given index is nonnegative and smaller than this big-list size.
|
boolean |
equals(java.lang.Object o) |
void |
forEach(java.util.function.Consumer<? super K> action) |
void |
getElements(long from,
java.lang.Object[][] a,
long offset,
long length)
Copies (hopefully quickly) elements of this type-specific big list into the given big array.
|
int |
hashCode()
Returns the hash code for this big list, which is identical to
List.hashCode(). |
long |
indexOf(java.lang.Object k) |
it.unimi.dsi.fastutil.objects.ObjectBigListIterator<K> |
iterator()
Returns a type-specific iterator on the elements of this list.
|
long |
lastIndexOf(java.lang.Object k) |
it.unimi.dsi.fastutil.objects.ObjectBigListIterator<K> |
listIterator()
Returns a type-specific big-list iterator on this type-specific big list.
|
it.unimi.dsi.fastutil.objects.ObjectBigListIterator<K> |
listIterator(long index)
Returns a type-specific list iterator on this type-specific big list starting at a given index.
|
K |
peek(int i) |
K |
pop() |
void |
push(K o) |
K |
remove(long i) |
void |
removeElements(long from,
long to)
Removes (hopefully quickly) elements of this type-specific big list.
|
K |
set(long index,
K k) |
void |
setElements(long index,
K[][] a,
long offset,
long length)
Set (hopefully quickly) elements to match the array given.
|
int |
size()
Deprecated.
Please use
Size64.size64() instead. |
void |
size(long size) |
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. |
K |
top() |
java.lang.String |
toString() |
containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArrayclone, finalize, getClass, notify, notifyAll, wait, wait, waitaddAll, addAll, addAll, addAll, getElements, setElements, setElements, spliteratorprotected void ensureIndex(long index)
index - an index.java.lang.IndexOutOfBoundsException - if the given index is negative or greater than this big-list size.protected void ensureRestrictedIndex(long index)
index - an index.java.lang.IndexOutOfBoundsException - if the given index is negative or not smaller than this big-list size.public void add(long index,
K k)
add in interface it.unimi.dsi.fastutil.BigList<K>public boolean add(K k)
public boolean addAll(long index,
java.util.Collection<? extends K> c)
addAll in interface it.unimi.dsi.fastutil.BigList<K>public boolean addAll(java.util.Collection<? extends K> c)
public it.unimi.dsi.fastutil.objects.ObjectBigListIterator<K> iterator()
iterator in interface it.unimi.dsi.fastutil.objects.ObjectIterable<K>iterator in interface ReferenceBigList<K>iterator in interface it.unimi.dsi.fastutil.objects.ReferenceCollection<K>iterator in interface java.lang.Iterable<K>iterator in interface java.util.Collection<K>iterator in class it.unimi.dsi.fastutil.objects.AbstractReferenceCollection<K>Collection.iterator()public it.unimi.dsi.fastutil.objects.ObjectBigListIterator<K> listIterator()
listIterator in interface it.unimi.dsi.fastutil.BigList<K>listIterator in interface ReferenceBigList<K>BigList.listIterator()public it.unimi.dsi.fastutil.objects.ObjectBigListIterator<K> listIterator(long index)
listIterator in interface it.unimi.dsi.fastutil.BigList<K>listIterator in interface ReferenceBigList<K>BigList.listIterator(long)public boolean contains(java.lang.Object k)
public long indexOf(java.lang.Object k)
indexOf in interface it.unimi.dsi.fastutil.BigList<K>public long lastIndexOf(java.lang.Object k)
lastIndexOf in interface it.unimi.dsi.fastutil.BigList<K>public void size(long size)
size in interface it.unimi.dsi.fastutil.BigList<K>public ReferenceBigList<K> subList(long from, long to)
ReferenceBigListfrom, inclusive, to the index to, exclusive.subList in interface it.unimi.dsi.fastutil.BigList<K>subList in interface ReferenceBigList<K>BigList.subList(long,long)public void forEach(java.util.function.Consumer<? super K> action)
forEach in interface java.lang.Iterable<K>public void removeElements(long from,
long to)
This 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>from - the start index (inclusive).to - the end index (exclusive).public void addElements(long index,
K[][] a,
long offset,
long length)
This is a trivial iterator-based implementation. It is expected that implementations will override this method with a more optimized version.
addElements in interface ReferenceBigList<K>index - the index at which to add elements.a - the big array containing the elements.offset - the offset of the first element to add.length - the number of elements to add.public void addElements(long index,
K[][] a)
addElements in interface ReferenceBigList<K>index - the index at which to add elements.a - the big array containing the elements.public void getElements(long from,
java.lang.Object[][] a,
long offset,
long length)
This is a trivial iterator-based implementation. It is expected that implementations will override this method with a more optimized version.
getElements in interface ReferenceBigList<K>from - the start index (inclusive).a - the destination big array.offset - the offset into the destination big array where to store the first element copied.length - the number of elements to be copied.public void setElements(long index,
K[][] a,
long offset,
long length)
ReferenceBigList
ListIterator iter = listIterator(index);
long i = 0;
while (i < length) {
iter.next();
iter.set(BigArrays.get(a, offset + i++);
}
However, the exact implementation may be more efficient, taking into account
whether random access is faster or not, or at the discretion of subclasses,
abuse internals.setElements in interface ReferenceBigList<K>index - the index at which to start setting elements.a - the big array containing the elements.offset - the offset of the first element to add.length - the number of elements to add.public void clear()
@Deprecated public int size()
Size64.size64() instead.public int hashCode()
List.hashCode().hashCode in interface java.util.Collection<K>hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in interface java.util.Collection<K>equals in class java.lang.Objectpublic java.lang.String toString()
toString in class it.unimi.dsi.fastutil.objects.AbstractReferenceCollection<K>