Interface ReferenceBigList<K>
- All Superinterfaces:
it.unimi.dsi.fastutil.BigList<K>,java.util.Collection<K>,java.lang.Iterable<K>,it.unimi.dsi.fastutil.objects.ObjectIterable<K>,ReferenceCollection<K>,it.unimi.dsi.fastutil.Size64
- All Known Implementing Classes:
AbstractReferenceBigList,AbstractReferenceBigList.ReferenceRandomAccessSubList,AbstractReferenceBigList.ReferenceSubList,ReferenceBigArrayBigList,ReferenceBigLists.EmptyBigList,ReferenceBigLists.ListBigList,ReferenceBigLists.Singleton,ReferenceBigLists.SynchronizedBigList,ReferenceBigLists.UnmodifiableBigList
public interface ReferenceBigList<K> extends it.unimi.dsi.fastutil.BigList<K>, ReferenceCollection<K>
BigList; provides some additional methods that use polymorphism to avoid (un)boxing.
Additionally, this interface strengthens iterator(), listIterator(),
listIterator(long) and subList(long,long).
This interface specifies reference equality semantics (members will be compared equal with
== instead of equals), which may result in breaks in contract
if attempted to be used with non reference-equality semantics based BigLists. For example, a
aReferenceBigList.equals(aObjectBigList) may return different a different result then
aObjectBigList.equals(aReferenceBigList), in violation of equals's contract
requiring it being symmetric.
Besides polymorphic methods, this interfaces specifies methods to copy into an array or remove contiguous sublists. Although the abstract implementation of this interface provides simple, one-by-one implementations of these methods, it is expected that concrete implementation override them with optimized versions.
- See Also:
List
-
Method Summary
Modifier and Type Method Description default booleanaddAll(long index, ReferenceBigList<? extends K> l)Inserts all of the elements in the specified type-specific big list into this type-specific big list at the specified position (optional operation).default booleanaddAll(long index, ReferenceList<? extends K> l)Inserts all of the elements in the specified type-specific list into this type-specific big list at the specified position (optional operation).default booleanaddAll(ReferenceBigList<? extends K> l)Appends all of the elements in the specified type-specific big list to the end of this type-specific big list (optional operation).default booleanaddAll(ReferenceList<? extends K> l)Appends all of the elements in the specified type-specific list to the end of this type-specific big list (optional operation).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.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.it.unimi.dsi.fastutil.objects.ObjectBigListIterator<K>iterator()Returns a type-specific iterator on the elements of this list.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.voidremoveElements(long from, long to)Removes (hopefully quickly) elements of this type-specific big list.default voidsetElements(long index, K[][] a)Set (hopefully quickly) elements to match the array given.default voidsetElements(long index, K[][] a, long offset, long length)Set (hopefully quickly) elements to match the array given.default voidsetElements(K[][] a)Set (hopefully quickly) elements to match the array given.default it.unimi.dsi.fastutil.objects.ObjectSpliterator<K>spliterator()Returns a type-specific spliterator on the elements of this big-list.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.Methods inherited from interface it.unimi.dsi.fastutil.BigList
add, addAll, get, indexOf, lastIndexOf, remove, set, size, sizeMethods inherited from interface java.util.Collection
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, parallelStream, remove, removeAll, removeIf, retainAll, stream, toArray, toArray, toArrayMethods inherited from interface java.lang.Iterable
forEachMethods inherited from interface it.unimi.dsi.fastutil.Size64
size64
-
Method Details
-
iterator
it.unimi.dsi.fastutil.objects.ObjectBigListIterator<K> iterator()Returns a type-specific iterator on the elements of this list.- 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 interfaceReferenceCollection<K>- Returns:
- a type-specific iterator on the elements of this collection.
- See Also:
Collection.iterator()- API Notes:
- This specification strengthens the one given in
Collection.iterator().
-
listIterator
it.unimi.dsi.fastutil.objects.ObjectBigListIterator<K> listIterator()Returns a type-specific big-list iterator on this type-specific big list.- Specified by:
listIteratorin interfaceit.unimi.dsi.fastutil.BigList<K>- See Also:
BigList.listIterator()- API Notes:
- This specification strengthens the one given in
BigList.listIterator().
-
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>- See Also:
BigList.listIterator(long)- API Notes:
- This specification strengthens the one given in
BigList.listIterator(long).
-
spliterator
Returns a type-specific spliterator on the elements of this big-list.BigList spliterators must report at least
Spliterator.SIZEDandSpliterator.ORDERED.See
List.spliterator()for more documentation on the requirements of the returned spliterator (despiteBigListnot being aList, most of the same requirements apply.- Specified by:
spliteratorin interfacejava.util.Collection<K>- Specified by:
spliteratorin interfacejava.lang.Iterable<K>- Specified by:
spliteratorin interfaceit.unimi.dsi.fastutil.objects.ObjectIterable<K>- Specified by:
spliteratorin interfaceReferenceCollection<K>- Returns:
- a type-specific spliterator on the elements of this collection.
- Since:
- 8.5.0
- API Notes:
- This is generally the only
spliteratormethod subclasses should override. - Implementation Specification:
- The default implementation returns a late-binding spliterator (see
Spliteratorfor documentation on what binding policies mean).- For
RandomAccesslists, this will return a spliterator that calls the type-specificBigList.get(long)method on the appropriate indexes. - Otherwise, the spliterator returned will wrap this instance's type specific
iterator().
In either case, the spliterator reports
Spliterator.SIZED,Spliterator.SUBSIZED, andSpliterator.ORDERED. - For
- Implementation Notes:
- As the non-RandomAccess case is based on the
iterator, and
Iteratoris an inherently linear API, the returned spliterator will yield limited performance gains when run in parallel contexts, as the returned spliterator'strySplit()will have linear runtime.For
RandomAccesslists, the parallel performance should be reasonable assumingBigList.get(long)is truly constant time likeRandomAccesssuggests.
-
subList
Returns 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>- See Also:
BigList.subList(long,long)- API Notes:
- This specification strengthens the one given in
BigList.subList(long,long).
-
getElements
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.- 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.
-
removeElements
void removeElements(long from, long to)Removes (hopefully quickly) elements of this type-specific big list.- Parameters:
from- the start index (inclusive).to- the end index (exclusive).
-
addElements
Add (hopefully quickly) elements to this type-specific big list.- Parameters:
index- the index at which to add elements.a- the big array containing the elements.
-
addElements
Add (hopefully quickly) elements to this type-specific big list.- 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.
-
setElements
Set (hopefully quickly) elements to match the array given.- Parameters:
a- the big array containing the elements.- Since:
- 8.5.0
-
setElements
Set (hopefully quickly) elements to match the array given.- Parameters:
index- the index at which to start setting elements.a- the big array containing the elements.- Since:
- 8.5.0
-
setElements
Set (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.- 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.- Since:
- 8.5.0
-
addAll
Inserts all of the elements in the specified type-specific big list into this type-specific big list at the specified position (optional operation).- See Also:
BigList.addAll(long,Collection)- API Notes:
- This method exists only for the sake of efficiency: override are expected to use
getElements(long, java.lang.Object[][], long, long)/addElements(long, K[][]). - Implementation Specification:
- This method delegates to the one accepting a collection, but it might be implemented more efficiently.
-
addAll
Appends all of the elements in the specified type-specific big list to the end of this type-specific big list (optional operation).- See Also:
Collection.addAll(Collection)- Implementation Specification:
- This method delegates to the index-based version, passing
BigList.size()as first argument.
-
addAll
Inserts all of the elements in the specified type-specific list into this type-specific big list at the specified position (optional operation).- See Also:
BigList.addAll(long,Collection)- API Notes:
- This method exists only for the sake of efficiency: override are expected to use
getElements(long, java.lang.Object[][], long, long)/addElements(long, K[][]). - Implementation Specification:
- This method delegates to the one accepting a collection, but it might be implemented more efficiently.
-
addAll
Appends all of the elements in the specified type-specific list to the end of this type-specific big list (optional operation).- See Also:
Collection.addAll(Collection)- Implementation Specification:
- This method delegates to the index-based version, passing
BigList.size()as first argument.
-