Class ObjectBigArray<T>
java.lang.Object
io.trino.array.ObjectBigArray<T>
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new big array containing one initial segmentObjectBigArray
(Object initialValue) -
Method Summary
Modifier and TypeMethodDescriptionvoid
copyTo
(long sourceIndex, ObjectBigArray<T> destination, long destinationIndex, long length) Copies this array, beginning at the specified sourceIndex, to the specified destinationIndex of the destination array.void
ensureCapacity
(long length) Ensures this big array is at least the specified length.void
Fills the entire big array with the specified value.get
(long index) Returns the element of this big array at specified index.Sets the element of this big array at the specified index, returning the previous element at that indexlong
Returns the current available capacity in this arrayboolean
Replaces the element of this big array at specified index.void
Sets the element of this big array at specified index.long
sizeOf()
Returns the size of this big array in bytes.
-
Constructor Details
-
ObjectBigArray
public ObjectBigArray()Creates a new big array containing one initial segment -
ObjectBigArray
-
-
Method Details
-
getCapacity
public long getCapacity()Returns the current available capacity in this array -
sizeOf
public long sizeOf()Returns the size of this big array in bytes. -
get
Returns the element of this big array at specified index.- Parameters:
index
- a position in this big array.- Returns:
- the element of this big array at the specified position.
-
set
Sets the element of this big array at specified index.- Parameters:
index
- a position in this big array.
-
getAndSet
Sets the element of this big array at the specified index, returning the previous element at that index- Parameters:
index
- a position in this big arrayvalue
- the new value to store at the specified position- Returns:
- the previous element at the specified position
-
replace
Replaces the element of this big array at specified index.- Parameters:
index
- a position in this big array.- Returns:
- true if the previous value was not null
-
ensureCapacity
public void ensureCapacity(long length) Ensures this big array is at least the specified length. If the array is smaller, segments are added until the array is larger then the specified length. -
fill
Fills the entire big array with the specified value. -
copyTo
public void copyTo(long sourceIndex, ObjectBigArray<T> destination, long destinationIndex, long length) Copies this array, beginning at the specified sourceIndex, to the specified destinationIndex of the destination array. A subsequence of this array's components are copied to the destination array referenced bydestination
. The number of components copied is equal to thelength
argument. The components at positionssourceIndex
throughsourceIndex+length-1
in this array are copied into positionsdestinationIndex
throughdestinationIndex+length-1
, respectively, of the destination array.
-