|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.vostok.io.Arrays
public class Arrays
A collection of static method to perform actions on arrays
Constructor Summary | |
---|---|
Arrays()
|
Method Summary | ||
---|---|---|
static
|
append(T[] obj,
T data)
append "data" to the end of "obj" this is an optimized version ( a little faster than java.util.Arrays.copyOf too) |
|
static
|
append(T[] obj,
T[] data)
append "data" to the end of "obj" Note all elements must be of the same class |
|
static
|
concat(T[]... a)
concat all arrays into a new one. didn't make copy of the inner Ts Note all arrays must be of the same type. |
|
static
|
flatten(T[] a)
flatten an array or arrays into a single dimention (new) array Note all element must be of the same class |
|
static
|
inject(T[] obj,
int index,
T data)
inject "data" into "obj" at index "index" Similar to others inject method, this one is optimized for injection of a single element Note all elements must be of the same class |
|
static
|
inject(T[] obj,
int index,
T[] data)
inject "data" into "obj", at the index "index". |
|
static
|
inject(T[] obj,
int index,
T data,
int length)
Inject into "obj" at index "index" as much as "length" from "data", If length=1 you should concider inject(T[] obj, int index, T data),instead Note all elements must be of the same class Be aware that beside for index, the method doesn't check for valid arguments |
|
static
|
move(T[] obj,
int from,
int to)
move the T at index "from" to index "to", shifting other element (up or down) For performances optimization, no arguments verification will be performed |
|
static
|
prepend(T[] obj,
T data)
prepend "data" to the start of "obj" |
|
static
|
prepend(T[] obj,
T[] data)
prepend "data" to the start of "obj" |
|
static
|
remove(T[] obj,
int index,
int length)
Remove as mutch as "length" element(s) at index "index" from "obj". |
|
static
|
shiftLeft(T[] obj,
int index,
int length,
int padding)
shift "length" element(s) at index "index" from the amount "padding", padding to the left. |
|
static
|
shiftRight(T[] obj,
int index,
int length,
int padding)
shift "length" element(s) at index "index" from the amount "padding", padding to the right. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Arrays()
Method Detail |
---|
public static <T> T[] concat(T[]... a)
T
- a
- list of arrays to concat
public static <T> T[] flatten(T[] a)
T
- a
- an array of T[] to flatten
public static <T> void move(T[] obj, int from, int to)
obj
- index
- public static <T> T[] remove(T[] obj, int index, int length)
obj
- index
- : index of first element to removelength
- : number of element to remove. if length bigger than element available, act as a troncate op
public static <T> void shiftLeft(T[] obj, int index, int length, int padding)
obj
- : arrays to work withindex
- : start indexlength
- : number of element(s) to shiftpadding
- :shift up to padding, or up to the beginning of the arraypublic static <T> void shiftRight(T[] obj, int index, int length, int padding)
obj
- : arrays to work withindex
- : start indexlength
- : number of element(s) to shiftpadding
- : shift up to padding, or until the end of the arraypublic static <T> T[] inject(T[] obj, int index, T[] data)
obj
- source arrayindex
- : index where to inject data. if index >= obj.length, append to the enddata
- : array to inject into obj
public static <T> T[] inject(T[] obj, int index, T data, int length)
obj
- the source arrayindex
- : where to inject the new data. if index >= obj.length, append to the enddata
- : T to addlength
- : number of data to add
public static <T> T[] inject(T[] obj, int index, T data)
obj
- index
- : index to inject element into. if index >= obj.length, append to the enddata
-
public static <T> T[] append(T[] obj, T data)
obj
- data
-
public static <T> T[] append(T[] obj, T[] data)
obj
- data
-
public static <T> T[] prepend(T[] obj, T data)
T
- obj
- data
-
public static <T> T[] prepend(T[] obj, T[] data)
T
- obj
- data
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |