Class AbstractReferenceBigList<K>
- All Implemented Interfaces:
it.unimi.dsi.fastutil.BigList<K>,it.unimi.dsi.fastutil.objects.ObjectIterable<K>,ReferenceBigList<K>,ReferenceCollection<K>,it.unimi.dsi.fastutil.Size64,it.unimi.dsi.fastutil.Stack<K>,java.lang.Iterable<K>,java.util.Collection<K>
- Direct Known Subclasses:
AbstractReferenceBigList.ReferenceSubList,ReferenceBigArrayBigList,ReferenceBigLists.ListBigList,ReferenceBigLists.Singleton
public abstract class AbstractReferenceBigList<K> extends 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.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractReferenceBigList.ReferenceRandomAccessSubList<K>static classAbstractReferenceBigList.ReferenceSubList<K>A class implementing a sublist view. -
Method Summary
Modifier and Type Method Description voidadd(long index, K k)booleanadd(K k)booleanaddAll(long index, java.util.Collection<? extends K> c)Adds all of the elements in the specified collection to this list (optional operation).booleanaddAll(java.util.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()booleancontains(java.lang.Object k)Returns true if this list contains the specified element.booleanequals(java.lang.Object o)voidforEach(java.util.function.Consumer<? super K> action)voidgetElements(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.inthashCode()Returns the hash code for this big list, which is identical toList.hashCode().longindexOf(java.lang.Object k)it.unimi.dsi.fastutil.objects.ObjectBigListIterator<K>iterator()Returns a type-specific iterator on the elements of this collection.longlastIndexOf(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.Kpeek(int i)Kpop()voidpush(K o)Kremove(long i)voidremoveElements(long from, long to)Removes (hopefully quickly) elements of this type-specific big list.Kset(long index, K k)voidsetElements(long index, K[][] a, long offset, long length)Set (hopefully quickly) elements to match the array given.intsize()Deprecated.voidsize(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 indexfrom, inclusive, to the indexto, exclusive.Ktop()java.lang.StringtoString()Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArrayMethods inherited from class java.lang.Object
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, setElements, setElements, spliteratorMethods inherited from interface it.unimi.dsi.fastutil.Size64
size64Methods inherited from interface it.unimi.dsi.fastutil.Stack
isEmpty
-
Method Details
-
add
- Specified by:
addin interfaceit.unimi.dsi.fastutil.BigList<K>- Implementation Specification:
- This implementation always throws an
UnsupportedOperationException.
-
add
-
remove
- Specified by:
removein interfaceit.unimi.dsi.fastutil.BigList<K>- Implementation Specification:
- This implementation always throws an
UnsupportedOperationException.
-
set
- Specified by:
setin interfaceit.unimi.dsi.fastutil.BigList<K>- Implementation Specification:
- This implementation always throws an
UnsupportedOperationException.
-
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
-
iterator
Returns a type-specific iterator on the elements of this collection.- Specified by:
iteratorin interfacejava.util.Collection<K>- Specified by:
iteratorin interfacejava.lang.Iterable<K>- Specified by:
iteratorin interfaceit.unimi.dsi.fastutil.objects.ObjectIterable<K>- Specified by:
iteratorin interfaceReferenceBigList<K>- Specified by:
iteratorin interfaceReferenceCollection<K>- Specified by:
iteratorin classAbstractReferenceCollection<K>- Returns:
- a type-specific iterator on the elements of this collection.
- See Also:
Collection.iterator()- Implementation Specification:
- This implementation delegates to
listIterator().
-
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:
BigList.listIterator()- Implementation Specification:
- This implementation delegates to
listIterator(0).
-
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:
BigList.listIterator(long)- Implementation Specification:
- This implementation is based on the random-access methods.
-
contains
public boolean contains(java.lang.Object k)Returns true if this list contains the specified element. -
indexOf
public long indexOf(java.lang.Object k)- Specified by:
indexOfin interfaceit.unimi.dsi.fastutil.BigList<K>
-
lastIndexOf
public long lastIndexOf(java.lang.Object k)- 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:
BigList.subList(long,long)
-
forEach
- Specified by:
forEachin interfacejava.lang.Iterable<K>- Implementation Specification:
- If this list is
RandomAccess, will iterate using a for loop and the type-specificList.get(int)method. Otherwise it will fallback to using the iterator based loop implementation from the superinterface.
-
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.- Implementation Specification:
- This implementation delegates to the analogous method for big-array fragments.
-
getElements
public 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.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 interfacejava.util.Collection<K>- Overrides:
clearin classjava.util.AbstractCollection<K>- Implementation Specification:
- This implementation delegates to
removeElements(long, long).
-
size
@Deprecated public int size()Deprecated.Please useSize64.size64()instead.- Specified by:
sizein interfaceit.unimi.dsi.fastutil.BigList<K>- Specified by:
sizein interfacejava.util.Collection<K>- Specified by:
sizein interfaceit.unimi.dsi.fastutil.Size64- Specified by:
sizein classjava.util.AbstractCollection<K>- Implementation Specification:
- This implementation delegates to
Size64.size64().
-
hashCode
public int hashCode()Returns the hash code for this big list, which is identical toList.hashCode().- Specified by:
hashCodein interfacejava.util.Collection<K>- Overrides:
hashCodein classjava.lang.Object- Returns:
- the hash code for this big list.
-
equals
public boolean equals(java.lang.Object o)- Specified by:
equalsin interfacejava.util.Collection<K>- Overrides:
equalsin classjava.lang.Object
-
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
public java.lang.String toString()- Overrides:
toStringin classAbstractReferenceCollection<K>
-
Size64.size64()instead.