Skip to content

Commit 9f3c67f

Browse files
committed
Add ArrayList.toArray() method
1 parent 9fed75b commit 9f3c67f

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/Processing.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3234,6 +3234,8 @@ class ArrayList<T, false> {
32343234
::std::vector<T> snapshot = other.data;
32353235
data.insert(data.begin()+idx, snapshot.begin(), snapshot.end());
32363236
}
3237+
::std::vector<T> toArray() const { return data; }
3238+
T* toArray(T* arr) const { ::std::copy(data.begin(),data.end(),arr); return arr; }
32373239
ArrayList<T,false> subList(int from, int to) const {
32383240
// Real java.util.ArrayList.subList() throws IndexOutOfBoundsException
32393241
// for fromIndex<0, toIndex>size(), or fromIndex>toIndex. Without this

0 commit comments

Comments
 (0)