Class LongArrayBuffer
java.lang.Object
com.oracle.truffle.regex.tregex.buffer.AbstractArrayBuffer
com.oracle.truffle.regex.tregex.buffer.LongArrayBuffer
This class is designed as a "scratchpad" for generating many long arrays of unknown size. It will
never shrink its internal buffer, so it should be disposed as soon as it is no longer needed.
Usage Example:
LongArrayBuffer buf = new LongArrayBuffer();
List<long[]> results = new ArrayList<>();
for (Object obj : listOfThingsToProcess) {
for (Object x : obj.thingsThatShouldBecomeLongs()) {
buf.add(someCalculation(x));
}
results.add(buf.toArray());
buf.clear();
}
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(long v) voidaddAll(long[] v) asFixedSizeArray(int size) asFixedSizeArray(int size, int initialValue) longget(int i) iterator()longpeek()longpop()long[]toArray()Methods inherited from class com.oracle.truffle.regex.tregex.buffer.AbstractArrayBuffer
clear, ensureCapacity, isEmpty, length, setLengthMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
buf
protected long[] buf
-
-
Constructor Details
-
LongArrayBuffer
public LongArrayBuffer(int initialSize)
-
-
Method Details