Class ObjectArrayBuffer<T>
java.lang.Object
com.oracle.truffle.regex.tregex.buffer.AbstractArrayBuffer
com.oracle.truffle.regex.tregex.buffer.ObjectArrayBuffer<T>
- All Implemented Interfaces:
Iterable<T>
This class is designed as a "scratchpad" for generating many Object 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:
SomeClass[] typedArray = new SomeClass[0];
ObjectArrayBuffer buf = new ObjectArrayBuffer();
List<SomeClass[]> results = new ArrayList<>();
for (Object obj : listOfThingsToProcess) {
for (Object x : obj.thingsThatShouldBecomeSomeClass()) {
buf.add(someCalculation(x));
}
results.add(buf.toArray(typedArray));
buf.clear();
}
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidaddAll(ObjectArrayBuffer<T> other) voidvoidasFixedSizeArray(int size) get(int i) iterator()peek()pop()voidvoidsort(Comparator<T> comparator) <ST> ST[]toArray(ST[] a) 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
-
Constructor Details
-
ObjectArrayBuffer
public ObjectArrayBuffer() -
ObjectArrayBuffer
public ObjectArrayBuffer(int initialSize)
-
-
Method Details
-
get
-
set
-
add
-
addAll
-
addAll
-
addAll
-
pop
-
peek
-
asFixedSizeArray
-
sort
-
toArray
public <ST> ST[] toArray(ST[] a) -
iterator
-