List of utility methods to do Array Shift
void | shift(Object a[], int count) shift if (count > 0) System.arraycopy(((Object) (a)), 0, ((Object) (a)), count, a.length - count); else System.arraycopy(((Object) (a)), -count, ((Object) (a)), 0, a.length + count); |
String[] | shift(String[] args, int count) shift String[] result = new String[args.length - count]; for (int i = 0; i < result.length; i++) { result[i] = args[(i + count)]; return result; |
String[] | shift(String[] array) shift return shift(array, 1);
|
String[] | shift(String[] in) shift String[] copy = new String[in.length - 1]; System.arraycopy(in, 1, copy, 0, in.length - 1); return copy; |
String[] | shift(String[] original, int offset) shift if (original.length <= offset) { throw new ArrayIndexOutOfBoundsException(); String[] output = new String[original.length - offset]; for (int i = offset; i < original.length; i++) { output[i - offset] = original[i]; return output; ... |
void | shift(String[] src, String word) shift for (int i = 0; i < src.length - 1; i++) { src[i] = src[i + 1]; src[src.length - 1] = word; |
String[] | shift(String[] tokens) shift return shift(tokens, 1);
|
T[] | shift(T[] array, int count) shift all elements of an array int length = array.length; T[] res = Arrays.copyOf(array, length); if (count == 0) { return res; for (int i = 0; i < length; i++) { int srcIdx = i - count; while (srcIdx < 0) { ... |
String[] | shiftArgs(final String[] args) Shifts an array of strings by one item to the left. return shiftArgs(args, 1);
|
String[] | shiftArgs(String[] args, int offset) shift Args String[] shiftedArgs = new String[args.length - offset]; for (int i = offset; i < args.length; i++) { shiftedArgs[i - offset] = args[i]; return shiftedArgs; |