add insert(index, item) for single elements

This commit is contained in:
Ben Fry
2014-11-11 09:26:13 -05:00
parent 45e9d12a3d
commit b3e3ebea72
3 changed files with 21 additions and 3 deletions

View File

@@ -299,6 +299,11 @@ public class FloatList implements Iterable<Float> {
// }
public void insert(int index, float value) {
insert(index, new float[] { value });
}
// same as splice
public void insert(int index, float[] values) {
if (index < 0) {
@@ -728,7 +733,8 @@ public class FloatList implements Iterable<Float> {
/**
* Copy as many values as possible into the specified array.
* Copy values into the specified array. If the specified array is null or
* not the same size, a new array will be allocated.
* @param array
*/
public float[] array(float[] array) {

View File

@@ -268,6 +268,11 @@ public class IntList implements Iterable<Integer> {
// }
public void insert(int index, int value) {
insert(index, new int[] { value });
}
// same as splice
public void insert(int index, int[] values) {
if (index < 0) {
@@ -673,7 +678,8 @@ public class IntList implements Iterable<Integer> {
/**
* Copy as many values as possible into the specified array.
* Copy values into the specified array. If the specified array is null or
* not the same size, a new array will be allocated.
* @param array
*/
public int[] array(int[] array) {

View File

@@ -307,6 +307,11 @@ public class StringList implements Iterable<String> {
// }
public void insert(int index, String value) {
insert(index, new String[] { value });
}
// same as splice
public void insert(int index, String[] values) {
if (index < 0) {
@@ -633,7 +638,8 @@ public class StringList implements Iterable<String> {
/**
* Copy as many values as possible into the specified array.
* Copy values into the specified array. If the specified array is null or
* not the same size, a new array will be allocated.
* @param array
*/
public String[] array(String[] array) {