Class AbstractLongBigList
- All Implemented Interfaces:
it.unimi.dsi.fastutil.BigList<Long>,LongBigList,it.unimi.dsi.fastutil.longs.LongCollection,it.unimi.dsi.fastutil.longs.LongIterable,it.unimi.dsi.fastutil.longs.LongStack,it.unimi.dsi.fastutil.Size64,it.unimi.dsi.fastutil.Stack<Long>,Comparable<it.unimi.dsi.fastutil.BigList<? extends Long>>,Iterable<Long>,Collection<Long>
- Direct Known Subclasses:
AbstractLongBigList.LongSubList,LongBigArrayBigList,LongBigLists.ListBigList,LongBigLists.Singleton,LongMappedBigList
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 java.lang.Long>)) 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 TypeMethodDescriptionbooleanadd(long k) voidadd(long index, long k) Inserts the specified element at the specified position in this type-specific big list (optional operation).voidDeprecated.Please use the corresponding type-specific method instead.booleanaddAll(long index, it.unimi.dsi.fastutil.longs.LongCollection c) Inserts all of the elements in the specified type-specific collection into this type-specific big list at the specified position (optional operation).booleanaddAll(long index, Collection<? extends Long> c) Adds all of the elements in the specified collection to this list (optional operation).booleanaddAll(it.unimi.dsi.fastutil.longs.LongCollection c) booleanaddAll(Collection<? extends Long> c) voidaddElements(long index, long[][] a) Add (hopefully quickly) elements to this type-specific big list.voidaddElements(long index, long[][] a, long offset, long length) Add (hopefully quickly) elements to this type-specific big list.voidclear()intCompares this big list to another object.booleancontains(long k) Returns 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.booleanvoidforEach(LongConsumer action) get(long index) Deprecated.Please use the corresponding type-specific method instead.voidgetElements(long from, long[][] 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(long k) Returns the index of the first occurrence of the specified element in this type-specific big list, or -1 if this big list does not contain the element.longDeprecated.Please use the corresponding type-specific method instead.it.unimi.dsi.fastutil.longs.LongBigListIteratoriterator()Returns a type-specific iterator on the elements of this list.longlastIndexOf(long k) Returns the index of the last occurrence of the specified element in this type-specific big list, or -1 if this big list does not contain the element.longlastIndexOf(Object ok) Deprecated.Please use the corresponding type-specific method instead.it.unimi.dsi.fastutil.longs.LongBigListIteratorReturns a type-specific big-list iterator on this type-specific big list.it.unimi.dsi.fastutil.longs.LongBigListIteratorlistIterator(long index) Returns a type-specific list iterator on this type-specific big list starting at a given index.peek(int i) Deprecated.Please use the corresponding type-specific method instead.longpeekLong(int i) pop()Deprecated.Please use the corresponding type-specific method instead.longpopLong()voidpush(long o) voidDeprecated.Please use the corresponding type-specific method instead.booleanrem(long k) Removes a single instance of the specified element from this collection, if it is present (optional operation).remove(long index) Deprecated.Please use the corresponding type-specific method instead.voidremoveElements(long from, long to) Removes (hopefully quickly) elements of this type-specific big list.longremoveLong(long i) Removes the element at the specified position.longset(long index, long k) Replaces the element at the specified position in this big list with the specified element (optional operation).Deprecated.Please use the corresponding type-specific method instead.voidsetElements(long index, long[][] a, long offset, long length) Set (hopefully quickly) elements to match the array given.intsize()Deprecated.Please useSize64.size64()instead.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()Deprecated.Please use the corresponding type-specific method instead.longtopLong()toString()Methods inherited from class it.unimi.dsi.fastutil.longs.AbstractLongCollection
add, contains, containsAll, containsAll, forEach, remove, removeAll, removeAll, removeIf, retainAll, retainAll, toArray, toLongArray, toLongArrayMethods inherited from class java.util.AbstractCollection
isEmpty, toArray, toArrayMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
containsAll, isEmpty, removeAll, retainAll, toArray, toArray, toArrayMethods inherited from interface it.unimi.dsi.fastutil.longs.LongBigList
addAll, addAll, addAll, addAll, getElements, getLong, setElements, setElements, spliteratorMethods inherited from interface it.unimi.dsi.fastutil.longs.LongCollection
add, contains, containsAll, longIterator, longParallelStream, longSpliterator, longStream, parallelStream, remove, removeAll, removeIf, removeIf, removeIf, retainAll, stream, toArray, toLongArray, toLongArrayMethods inherited from interface it.unimi.dsi.fastutil.longs.LongIterable
forEach, forEachMethods inherited from interface it.unimi.dsi.fastutil.Size64
size64Methods inherited from interface it.unimi.dsi.fastutil.Stack
isEmpty
-
Constructor Details
-
AbstractLongBigList
protected AbstractLongBigList()
-
-
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
public void add(long index, long k) Inserts the specified element at the specified position in this type-specific big list (optional operation).- Specified by:
addin interfaceLongBigList- See Also:
-
add
public boolean add(long k) - Specified by:
addin interfaceit.unimi.dsi.fastutil.longs.LongCollection- Overrides:
addin classit.unimi.dsi.fastutil.longs.AbstractLongCollection
-
removeLong
public long removeLong(long i) Removes the element at the specified position.- Specified by:
removeLongin interfaceLongBigList- See Also:
-
set
public long set(long index, long k) Replaces the element at the specified position in this big list with the specified element (optional operation).- Specified by:
setin interfaceLongBigList- See Also:
-
addAll
Adds all of the elements in the specified collection to this list (optional operation).- Specified by:
addAllin interfaceit.unimi.dsi.fastutil.BigList<Long>
-
addAll
- Specified by:
addAllin interfaceCollection<Long>- Overrides:
addAllin classit.unimi.dsi.fastutil.longs.AbstractLongCollection
-
iterator
public it.unimi.dsi.fastutil.longs.LongBigListIterator iterator()Returns a type-specific iterator on the elements of this list.- Specified by:
iteratorin interfaceCollection<Long>- Specified by:
iteratorin interfaceIterable<Long>- Specified by:
iteratorin interfaceLongBigList- Specified by:
iteratorin interfaceit.unimi.dsi.fastutil.longs.LongCollection- Specified by:
iteratorin interfaceit.unimi.dsi.fastutil.longs.LongIterable- Specified by:
iteratorin classit.unimi.dsi.fastutil.longs.AbstractLongCollection- See Also:
-
listIterator
public it.unimi.dsi.fastutil.longs.LongBigListIterator listIterator()Returns a type-specific big-list iterator on this type-specific big list.- Specified by:
listIteratorin interfaceit.unimi.dsi.fastutil.BigList<Long>- Specified by:
listIteratorin interfaceLongBigList- See Also:
-
listIterator
public it.unimi.dsi.fastutil.longs.LongBigListIterator listIterator(long index) 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<Long>- Specified by:
listIteratorin interfaceLongBigList- See Also:
-
contains
public boolean contains(long k) Returns true if this list contains the specified element.- Specified by:
containsin interfaceit.unimi.dsi.fastutil.longs.LongCollection- Overrides:
containsin classit.unimi.dsi.fastutil.longs.AbstractLongCollection- See Also:
-
indexOf
public long indexOf(long k) Description copied from interface:LongBigListReturns the index of the first occurrence of the specified element in this type-specific big list, or -1 if this big list does not contain the element.- Specified by:
indexOfin interfaceLongBigList- See Also:
-
lastIndexOf
public long lastIndexOf(long k) Description copied from interface:LongBigListReturns the index of the last occurrence of the specified element in this type-specific big list, or -1 if this big list does not contain the element.- Specified by:
lastIndexOfin interfaceLongBigList- See Also:
-
size
public void size(long size) - Specified by:
sizein interfaceit.unimi.dsi.fastutil.BigList<Long>
-
subList
Description copied from interface:LongBigListReturns 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<Long>- Specified by:
subListin interfaceLongBigList- See Also:
-
forEach
- Specified by:
forEachin interfaceit.unimi.dsi.fastutil.longs.LongIterable
-
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 interfaceLongBigList- Parameters:
from- the start index (inclusive).to- the end index (exclusive).
-
addElements
public void addElements(long index, long[][] a, long offset, long length) 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 interfaceLongBigList- 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
public void addElements(long index, long[][] a) Add (hopefully quickly) elements to this type-specific big list.- Specified by:
addElementsin interfaceLongBigList- Parameters:
index- the index at which to add elements.a- the big array containing the elements.
-
getElements
public void getElements(long from, long[][] 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 interfaceLongBigList- 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
public void setElements(long index, long[][] a, long offset, long length) Description copied from interface:LongBigListSet (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 interfaceLongBigList- 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<Long>- Overrides:
clearin classAbstractCollection<Long>
-
size
Deprecated.Please useSize64.size64()instead.- Specified by:
sizein interfaceit.unimi.dsi.fastutil.BigList<Long>- Specified by:
sizein interfaceCollection<Long>- Specified by:
sizein interfaceit.unimi.dsi.fastutil.Size64- Specified by:
sizein classAbstractCollection<Long>
-
hashCode
public int hashCode()Returns the hash code for this big list, which is identical toList.hashCode().- Specified by:
hashCodein interfaceCollection<Long>- Overrides:
hashCodein classObject- Returns:
- the hash code for this big list.
-
equals
- Specified by:
equalsin interfaceCollection<Long>- Overrides:
equalsin classObject
-
compareTo
Compares this big list to another object. If the argument is aBigList, this method performs a lexicographical comparison; otherwise, it throws aClassCastException.- Specified by:
compareToin interfaceComparable<it.unimi.dsi.fastutil.BigList<? extends Long>>- Parameters:
l- a big list.- Returns:
- if the argument is a
BigList, a negative integer, zero, or a positive integer as this list is lexicographically less than, equal to, or greater than the argument. - Throws:
ClassCastException- if the argument is not a big list.
-
push
public void push(long o) - Specified by:
pushin interfaceit.unimi.dsi.fastutil.longs.LongStack
-
popLong
public long popLong()- Specified by:
popLongin interfaceit.unimi.dsi.fastutil.longs.LongStack
-
topLong
public long topLong()- Specified by:
topLongin interfaceit.unimi.dsi.fastutil.longs.LongStack
-
peekLong
public long peekLong(int i) - Specified by:
peekLongin interfaceit.unimi.dsi.fastutil.longs.LongStack
-
rem
public boolean rem(long k) Removes a single instance of the specified element from this collection, if it is present (optional operation).- Specified by:
remin interfaceit.unimi.dsi.fastutil.longs.LongCollection- Overrides:
remin classit.unimi.dsi.fastutil.longs.AbstractLongCollection- See Also:
-
addAll
public boolean addAll(long index, it.unimi.dsi.fastutil.longs.LongCollection c) Inserts all of the elements in the specified type-specific collection into this type-specific big list at the specified position (optional operation).- Specified by:
addAllin interfaceLongBigList- See Also:
-
addAll
public boolean addAll(it.unimi.dsi.fastutil.longs.LongCollection c) - Specified by:
addAllin interfaceit.unimi.dsi.fastutil.longs.LongCollection- Overrides:
addAllin classit.unimi.dsi.fastutil.longs.AbstractLongCollection
-
add
Deprecated.Please use the corresponding type-specific method instead.- Specified by:
addin interfaceit.unimi.dsi.fastutil.BigList<Long>- Specified by:
addin interfaceLongBigList
-
set
Deprecated.Please use the corresponding type-specific method instead.- Specified by:
setin interfaceit.unimi.dsi.fastutil.BigList<Long>- Specified by:
setin interfaceLongBigList
-
get
Deprecated.Please use the corresponding type-specific method instead.- Specified by:
getin interfaceit.unimi.dsi.fastutil.BigList<Long>- Specified by:
getin interfaceLongBigList
-
indexOf
Deprecated.Please use the corresponding type-specific method instead.- Specified by:
indexOfin interfaceit.unimi.dsi.fastutil.BigList<Long>- Specified by:
indexOfin interfaceLongBigList
-
lastIndexOf
Deprecated.Please use the corresponding type-specific method instead.- Specified by:
lastIndexOfin interfaceit.unimi.dsi.fastutil.BigList<Long>- Specified by:
lastIndexOfin interfaceLongBigList
-
remove
Deprecated.Please use the corresponding type-specific method instead.- Specified by:
removein interfaceit.unimi.dsi.fastutil.BigList<Long>- Specified by:
removein interfaceLongBigList
-
push
Deprecated.Please use the corresponding type-specific method instead.- Specified by:
pushin interfaceit.unimi.dsi.fastutil.longs.LongStack- Specified by:
pushin interfaceit.unimi.dsi.fastutil.Stack<Long>
-
pop
Deprecated.Please use the corresponding type-specific method instead.- Specified by:
popin interfaceit.unimi.dsi.fastutil.longs.LongStack- Specified by:
popin interfaceit.unimi.dsi.fastutil.Stack<Long>
-
top
Deprecated.Please use the corresponding type-specific method instead.- Specified by:
topin interfaceit.unimi.dsi.fastutil.longs.LongStack- Specified by:
topin interfaceit.unimi.dsi.fastutil.Stack<Long>
-
peek
Deprecated.Please use the corresponding type-specific method instead.- Specified by:
peekin interfaceit.unimi.dsi.fastutil.longs.LongStack- Specified by:
peekin interfaceit.unimi.dsi.fastutil.Stack<Long>
-
toString
- Overrides:
toStringin classit.unimi.dsi.fastutil.longs.AbstractLongCollection
-