public class IntList
extends java.lang.Object
implements java.lang.Iterable<java.lang.Integer>
FloatList
,
StringList
Constructor and Description |
---|
IntList() |
IntList(int length) |
IntList(int[] source) |
IntList(java.lang.Iterable<java.lang.Object> iter)
Construct an IntList from an iterable pile of objects.
|
IntList(java.lang.Object... items)
Construct an IntList from a random pile of objects.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
int amount) |
void |
append(int value)
Add a new entry to the list.
|
void |
append(int[] values) |
void |
append(IntList list) |
void |
appendUnique(int value)
Add this value, but only if it's not already in the list.
|
int[] |
array()
Create a new array with a copy of all the values.
|
int[] |
array(int[] array)
Copy values into the specified array.
|
void |
clear()
Remove all entries from the list.
|
IntList |
copy() |
void |
div(int index,
int amount) |
static IntList |
fromRange(int stop) |
static IntList |
fromRange(int start,
int stop) |
int |
get(int index)
Get an entry at a particular index.
|
FloatList |
getPercent()
Returns a normalized version of this array.
|
IntList |
getSubset(int start) |
IntList |
getSubset(int start,
int num) |
boolean |
hasValue(int value) |
void |
increment(int index) |
int |
index(int what)
Return the first index of a particular value.
|
void |
insert(int index,
int value) |
void |
insert(int index,
int[] values) |
void |
insert(int index,
IntList list) |
java.util.Iterator<java.lang.Integer> |
iterator() |
java.lang.String |
join(java.lang.String separator) |
int |
max() |
int |
maxIndex() |
int |
min() |
int |
minIndex() |
void |
mult(int index,
int amount) |
int |
pop() |
void |
print() |
void |
push(int value)
Just an alias for append(), but matches pop()
|
int |
remove(int index)
Remove an element from the specified index
|
int |
removeValue(int value) |
int |
removeValues(int value) |
void |
resize(int length) |
void |
reverse() |
void |
save(java.io.File file)
Save tab-delimited entries to a file (TSV format, UTF-8 encoding)
|
void |
set(int index,
int what)
Set the entry at a particular index.
|
void |
shuffle()
Randomize the order of the list elements.
|
void |
shuffle(PApplet sketch)
Randomize the list order using the random() function from the specified
sketch, allowing shuffle() to use its current randomSeed() setting.
|
int |
size()
Get the length of the list.
|
void |
sort()
Sorts the array in place.
|
void |
sortReverse()
Reverse sort, orders values from highest to lowest.
|
void |
sub(int index,
int amount) |
int |
sum() |
long |
sumLong() |
java.lang.String |
toJSON()
Return this dictionary as a String in JSON format.
|
java.lang.String |
toString() |
int[] |
values()
Returns the actual array being used to store the data.
|
void |
write(java.io.PrintWriter writer)
Write entries to a PrintWriter, one per line
|
public IntList()
public IntList(int length)
public IntList(int[] source)
public IntList(java.lang.Iterable<java.lang.Object> iter)
public IntList(java.lang.Object... items)
public static IntList fromRange(int stop)
public static IntList fromRange(int start, int stop)
public int size()
public void resize(int length)
public void clear()
public int get(int index)
public void set(int index, int what)
public void push(int value)
public int pop()
public int remove(int index)
public int removeValue(int value)
public int removeValues(int value)
public void append(int value)
public void append(int[] values)
public void append(IntList list)
public void appendUnique(int value)
public void insert(int index, int value)
public void insert(int index, int[] values)
public void insert(int index, IntList list)
public int index(int what)
public boolean hasValue(int value)
public void increment(int index)
public void add(int index, int amount)
public void sub(int index, int amount)
public void mult(int index, int amount)
public void div(int index, int amount)
public int min()
public int minIndex()
public int max()
public int maxIndex()
public int sum()
public long sumLong()
public void sort()
public void sortReverse()
public void reverse()
public void shuffle()
public void shuffle(PApplet sketch)
public IntList copy()
public int[] values()
public java.util.Iterator<java.lang.Integer> iterator()
iterator
in interface java.lang.Iterable<java.lang.Integer>
public int[] array()
public int[] array(int[] array)
array
- public FloatList getPercent()
public IntList getSubset(int start)
public IntList getSubset(int start, int num)
public java.lang.String join(java.lang.String separator)
public void print()
public void save(java.io.File file)
public void write(java.io.PrintWriter writer)
public java.lang.String toJSON()
public java.lang.String toString()
toString
in class java.lang.Object