Java Array Shift shift(String[] tokens)

Here you can find the source of shift(String[] tokens)

Description

shift

License

Open Source License

Declaration

public static String[] shift(String[] tokens) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String[] shift(String[] tokens) {
        return shift(tokens, 1);
    }// w ww. j a va 2 s.c o  m

    public static String[] shift(String[] tokens, int shift) {
        if (shift == 0) {
            return tokens;
        }
        int n = tokens.length;
        if (n < shift) {
            return null;
        }
        return copy(tokens, shift, n - shift);
    }

    public static String[] copy(String[] array, int offset, int length) {
        assert (array.length >= offset + length);
        String[] aa = new String[length];
        System.arraycopy(array, offset, aa, 0, length);
        return aa;
    }
}

Related

  1. shift(String[] args, int count)
  2. shift(String[] array)
  3. shift(String[] in)
  4. shift(String[] original, int offset)
  5. shift(String[] src, String word)
  6. shift(T[] array, int count)
  7. shiftArgs(final String[] args)
  8. shiftArgs(String[] args, int offset)
  9. shiftArray(String[] args, int shift)