Class AbstractReferenceBigList<K>
- All Implemented Interfaces:
it.unimi.dsi.fastutil.BigList<K>,it.unimi.dsi.fastutil.objects.ObjectIterable<K>,ReferenceBigList<K>,it.unimi.dsi.fastutil.objects.ReferenceCollection<K>,it.unimi.dsi.fastutil.Size64,it.unimi.dsi.fastutil.Stack<K>,Iterable<K>,Collection<K>
- Direct Known Subclasses:
AbstractReferenceBigList.ReferenceSubList,ReferenceBigArrayBigList,ReferenceBigLists.ListBigList,ReferenceBigLists.Singleton
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classA class implementing a sublist view. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleanbooleanaddAll(long index, Collection<? extends K> c) Adds all of the elements in the specified collection to this list (optional operation).booleanaddAll(Collection<? extends K> c) voidaddElements(long index, K[][] a) Add (hopefully quickly) elements to this type-specific big list.voidaddElements(long index, K[][] a, long offset, long length) Add (hopefully quickly) elements to this type-specific big list.voidclear()booleanReturns true if this list contains the specified element.protected voidensureIndex(long index) Ensures that the given index is nonnegative and not greater than this big-list size.protected voidensureRestrictedIndex(long index) Ensures that the given index is nonnegative and smaller than this big-list size.booleanvoidvoidgetElements(long from, Object[][] a, long offset, long length) Copies (hopefully quickly) elements of this type-specific big list into the given big array.inthashCode()Returns the hash code for this big list, which is identical toList.hashCode().longit.unimi.dsi.fastutil.objects.ObjectBigListIterator<K> iterator()Returns a type-specific iterator on the elements of this list.longit.unimi.dsi.fastutil.objects.ObjectBigListIterator<K> 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.peek(int i) pop()voidremove(long i) voidremoveElements(long from, long to) Removes (hopefully quickly) elements of this type-specific big list.voidsetElements(long index, K[][] a, long offset, long length) Set (hopefully quickly) elements to match the array given.intsize()Deprecated.voidsize(long size) subList(long from, long to) Returns a type-specific view of the portion of this type-specific big list from the indexfrom, inclusive, to the indexto, exclusive.top()toString()Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArrayMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface it.unimi.dsi.fastutil.BigList
getMethods inherited from interface java.util.Collection
containsAll, isEmpty, parallelStream, remove, removeAll, removeIf, retainAll, stream, toArray, toArray, toArrayMethods inherited from interface it.unimi.dsi.fastutil.objects.ReferenceBigList
addAll, addAll, addAll, addAll, getElements, setElements, setElements, spliteratorMethods inherited from interface it.unimi.dsi.fastutil.Size64
size64Methods inherited from interface it.unimi.dsi.fastutil.Stack
isEmpty
-
Constructor Details
-
AbstractReferenceBigList
protected AbstractReferenceBigList()
-
-
Method Details
-
ensureIndex
protected void ensureIndex(long index) Ensures that the given index is nonnegative and not greater than this big-list size.- Parameters:
index- an index.- Throws:
IndexOutOfBoundsException- if the given index is negative or greater than this big-list size.
-
ensureRestrictedIndex
protected void ensureRestrictedIndex(long index) Ensures that the given index is nonnegative and smaller than this big-list size.- Parameters:
index- an index.- Throws:
IndexOutOfBoundsException- if the given index is negative or not smaller than this big-list size.
-
add
- Specified by:
addin interfaceit.unimi.dsi.fastutil.BigList<K>
-
add
- Specified by:
addin interfaceCollection<K>- Overrides:
addin classAbstractCollection<K>
-
remove
- Specified by:
removein interfaceit.unimi.dsi.fastutil.BigList<K>
-
set
- Specified by:
setin interfaceit.unimi.dsi.fastutil.BigList<K>
-
addAll
Adds all of the elements in the specified collection to this list (optional operation).- Specified by:
addAllin interfaceit.unimi.dsi.fastutil.BigList<K>
-
addAll
- Specified by:
addAllin interfaceCollection<K>- Overrides:
addAllin classAbstractCollection<K>
-
iterator
Returns a type-specific iterator on the elements of this list.- Specified by:
iteratorin interfaceCollection<K>- Specified by:
iteratorin interfaceIterable<K>- Specified by:
iteratorin interfaceit.unimi.dsi.fastutil.objects.ObjectIterable<K>- Specified by:
iteratorin interfaceReferenceBigList<K>- Specified by:
iteratorin interfaceit.unimi.dsi.fastutil.objects.ReferenceCollection<K>- Specified by:
iteratorin classit.unimi.dsi.fastutil.objects.AbstractReferenceCollection<K>- See Also:
-
listIterator
Returns a type-specific big-list iterator on this type-specific big list.- Specified by:
listIteratorin interfaceit.unimi.dsi.fastutil.BigList<K>- Specified by:
listIteratorin interfaceReferenceBigList<K>- See Also:
-
listIterator
Returns a type-specific list iterator on this type-specific big list starting at a given index.- Specified by:
listIteratorin interfaceit.unimi.dsi.fastutil.BigList<K>- Specified by:
listIteratorin interfaceReferenceBigList<K>- See Also:
-
contains
Returns true if this list contains the specified element.- Specified by:
containsin interfaceCollection<K>- Overrides:
containsin classAbstractCollection<K>- See Also:
-
indexOf
- Specified by:
indexOfin interfaceit.unimi.dsi.fastutil.BigList<K>
-
lastIndexOf
- Specified by:
lastIndexOfin interfaceit.unimi.dsi.fastutil.BigList<K>
-
size
public void size(long size) - Specified by:
sizein interfaceit.unimi.dsi.fastutil.BigList<K>
-
subList
Description copied from interface:ReferenceBigListReturns a type-specific view of the portion of this type-specific big list from the indexfrom, inclusive, to the indexto, exclusive.- Specified by:
subListin interfaceit.unimi.dsi.fastutil.BigList<K>- Specified by:
subListin interfaceReferenceBigList<K>- See Also:
-
forEach
-
removeElements
public void removeElements(long from, long to) Removes (hopefully quickly) elements of this type-specific big list.This is a trivial iterator-based implementation. It is expected that implementations will override this method with a more optimized version.
- Specified by:
removeElementsin interfaceReferenceBigList<K>- Parameters:
from- the start index (inclusive).to- the end index (exclusive).
-
addElements
Add (hopefully quickly) elements to this type-specific big list.This is a trivial iterator-based implementation. It is expected that implementations will override this method with a more optimized version.
- Specified by:
addElementsin interfaceReferenceBigList<K>- Parameters:
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.
-
addElements
Add (hopefully quickly) elements to this type-specific big list.- Specified by:
addElementsin interfaceReferenceBigList<K>- Parameters:
index- the index at which to add elements.a- the big array containing the elements.
-
getElements
Copies (hopefully quickly) elements of this type-specific big list into the given big array.This is a trivial iterator-based implementation. It is expected that implementations will override this method with a more optimized version.
- Specified by:
getElementsin interfaceReferenceBigList<K>- Parameters:
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.
-
setElements
Description copied from interface:ReferenceBigListSet (hopefully quickly) elements to match the array given. Sets each in this list to the corresponding elements in the array, as if byListIterator 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.- Specified by:
setElementsin interfaceReferenceBigList<K>- Parameters:
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.
-
clear
public void clear()- Specified by:
clearin interfaceCollection<K>- Overrides:
clearin classAbstractCollection<K>
-
size
Deprecated.Please useSize64.size64()instead.- Specified by:
sizein interfaceit.unimi.dsi.fastutil.BigList<K>- Specified by:
sizein interfaceCollection<K>- Specified by:
sizein interfaceit.unimi.dsi.fastutil.Size64- Specified by:
sizein classAbstractCollection<K>
-
hashCode
public int hashCode()Returns the hash code for this big list, which is identical toList.hashCode().- Specified by:
hashCodein interfaceCollection<K>- Overrides:
hashCodein classObject- Returns:
- the hash code for this big list.
-
equals
- Specified by:
equalsin interfaceCollection<K>- Overrides:
equalsin classObject
-
push
- Specified by:
pushin interfaceit.unimi.dsi.fastutil.Stack<K>
-
pop
- Specified by:
popin interfaceit.unimi.dsi.fastutil.Stack<K>
-
top
- Specified by:
topin interfaceit.unimi.dsi.fastutil.Stack<K>
-
peek
- Specified by:
peekin interfaceit.unimi.dsi.fastutil.Stack<K>
-
toString
- Overrides:
toStringin classit.unimi.dsi.fastutil.objects.AbstractReferenceCollection<K>
-
Size64.size64()instead.