a port of the Processing Visualization Language
Name

expand()

Examples
int[] data = {0, 1, 3, 4};
println(data.length);  // Prints "4"
data = expand(data);
println(data.length);  // Prints "8"
data = expand(data, 512);
println(data.length);  // Prints "512"

PImage[] imgs = new PImage[32];
println(imgs.length);  // Prints "32"
imgs = (PImage[]) expand(imgs);
println(imgs.length);  // Prints "64"
Description

Increases the size of an array. By default, this function doubles the size of the array, but the optional newSize parameter provides precise control over the increase in size.

When using an array of objects, the data returned from the function must be cast to the object array's data type. For example: SomeClass[] items = (SomeClass[]) expand(originalArray).

Syntax
expand(array)

expand(array,newSize)
Parameters
array boolean[], byte[], char[], int[], float[], String[], or an array of objects
newSize positive int: new size for the array
Returns Array (the same datatype as the input)
Usage Web & Application
Related concat()

This reference is licensed under the CC BY-NC-SA 2.0 license:

Creative Commons License
Fork me on GitHub