public class LongList
extends Object
implements Iterable<Long>
FloatList
,
StringList
Constructor and Description |
---|
LongList() |
LongList(int length) |
LongList(int[] source) |
LongList(Iterable<Object> iter)
Construct an IntList from an iterable pile of objects.
|
LongList(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[] values) |
void |
append(long value)
Add a new entry to the list.
|
void |
append(LongList 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.
|
LongList |
copy() |
void |
div(int index,
int amount) |
static LongList |
fromRange(int stop) |
static LongList |
fromRange(int start,
int stop) |
long |
get(int index)
Get an entry at a particular index.
|
FloatList |
getPercent()
Returns a normalized version of this array.
|
LongList |
getSubset(int start) |
LongList |
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,
long value) |
void |
insert(int index,
long[] values) |
void |
insert(int index,
LongList list) |
Iterator<Long> |
iterator() |
String |
join(String separator) |
long |
max() |
int |
maxIndex() |
long |
min() |
int |
minIndex() |
void |
mult(int index,
int amount) |
long |
pop() |
void |
print() |
void |
push(int value)
Just an alias for append(), but matches pop()
|
long |
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(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() |
String |
toJSON()
Return this dictionary as a String in JSON format.
|
String |
toString() |
long[] |
values()
Returns the actual array being used to store the data.
|
void |
write(PrintWriter writer)
Write entries to a PrintWriter, one per line
|
public LongList()
public LongList(int length)
public LongList(int[] source)
public LongList(Iterable<Object> iter)
public LongList(Object... items)
public static LongList fromRange(int stop)
public static LongList fromRange(int start, int stop)
public int size()
public void resize(int length)
public void clear()
public long get(int index)
public void set(int index, int what)
public void push(int value)
public long pop()
public long remove(int index)
public int removeValue(int value)
public int removeValues(int value)
public void append(long value)
public void append(int[] values)
public void append(LongList list)
public void appendUnique(int value)
public void insert(int index, long value)
public void insert(int index, long[] values)
public void insert(int index, LongList 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 long min()
public int minIndex()
public long 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 LongList copy()
public long[] values()
public Iterator<Long> iterator()
iterator
in interface Iterable<Long>
public int[] array()
public int[] array(int[] array)
array
- public FloatList getPercent()
public LongList getSubset(int start)
public LongList getSubset(int start, int num)
public String join(String separator)
public void print()
public void save(File file)
public void write(PrintWriter writer)
public String toJSON()
public String toString()
toString
in class Object