Java Array Remove removeFirst(String[] in)

Here you can find the source of removeFirst(String[] in)

Description

Returns a copy of in, but without the first element.

License

Creative Commons License

Parameter

Parameter Description
in The array to copy. Must not be null

Return

The copy

Declaration

public static String[] removeFirst(String[] in) 

Method Source Code


//package com.java2s;
//License from project: Creative Commons License 

import java.util.Arrays;

public class Main {
    /**/*from  w w w .  j  a  v a2  s. c o  m*/
     * Returns a copy of in, but without the first element.
     * 
     * @param in The array to copy. Must not be null
     * @return The copy
     */
    public static String[] removeFirst(String[] in) {
        if (in.length == 0) {
            return new String[0];
        }

        return Arrays.copyOfRange(in, 1, in.length);
    }
}

Related

  1. removeElementInStringArray(String[] array, int index)
  2. removeEmpties(String[] array)
  3. removeEmtpyStrings(String[] strings)
  4. removeFirst(String[] args)
  5. removeFirst(String[] array)
  6. removeFirst(String[] strArr)
  7. removeFirstElementFromArray(T[] array)
  8. removeFirstTwoArgs(String[] args, int startIndex)
  9. removeFlag(String[] options, String flag)