Skip to content

Commit 4edaacd

Browse files
committed
add insert(index, item) for single elements
1 parent b48f27f commit 4edaacd

3 files changed

Lines changed: 21 additions & 3 deletions

File tree

core/src/processing/data/FloatList.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,11 @@ public void append(FloatList list) {
299299
// }
300300

301301

302+
public void insert(int index, float value) {
303+
insert(index, new float[] { value });
304+
}
305+
306+
302307
// same as splice
303308
public void insert(int index, float[] values) {
304309
if (index < 0) {
@@ -728,7 +733,8 @@ public float[] array() {
728733

729734

730735
/**
731-
* Copy as many values as possible into the specified array.
736+
* Copy values into the specified array. If the specified array is null or
737+
* not the same size, a new array will be allocated.
732738
* @param array
733739
*/
734740
public float[] array(float[] array) {

core/src/processing/data/IntList.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,11 @@ public void append(IntList list) {
268268
// }
269269

270270

271+
public void insert(int index, int value) {
272+
insert(index, new int[] { value });
273+
}
274+
275+
271276
// same as splice
272277
public void insert(int index, int[] values) {
273278
if (index < 0) {
@@ -673,7 +678,8 @@ public int[] array() {
673678

674679

675680
/**
676-
* Copy as many values as possible into the specified array.
681+
* Copy values into the specified array. If the specified array is null or
682+
* not the same size, a new array will be allocated.
677683
* @param array
678684
*/
679685
public int[] array(int[] array) {

core/src/processing/data/StringList.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,11 @@ public void append(StringList list) {
307307
// }
308308

309309

310+
public void insert(int index, String value) {
311+
insert(index, new String[] { value });
312+
}
313+
314+
310315
// same as splice
311316
public void insert(int index, String[] values) {
312317
if (index < 0) {
@@ -633,7 +638,8 @@ public String[] array() {
633638

634639

635640
/**
636-
* Copy as many values as possible into the specified array.
641+
* Copy values into the specified array. If the specified array is null or
642+
* not the same size, a new array will be allocated.
637643
* @param array
638644
*/
639645
public String[] array(String[] array) {

0 commit comments

Comments
 (0)