Java Array Remove remove(T[] a, int i)

Here you can find the source of remove(T[] a, int i)

Description

remove

License

Apache License

Declaration

public static <T> T[] remove(T[] a, int i) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.*;

public class Main {
    public static <T> T[] remove(T[] a, int i) {
        T[] tmp = Arrays.copyOf(a, a.length - 1);
        System.arraycopy(a, i + 1, tmp, i, tmp.length - i);
        return tmp;
    }// www . j  a v a2 s . c  o  m

    public static int[] remove(int[] a, int i) {
        int[] tmp = Arrays.copyOf(a, a.length - 1);
        System.arraycopy(a, i + 1, tmp, i, tmp.length - i);
        return tmp;
    }
}

Related

  1. remove(boolean[] array, boolean value)
  2. remove(int[] a, int[] b)
  3. remove(String[] initial, String... toExclude)
  4. remove(String[] target, String[] needRemoved)
  5. removeAll(E[] array, Object... toRemove)
  6. removeAll(T[] array, Collection toRemove)
  7. removeAll(T[] items, T item)
  8. RemoveArgs(String[] args, int startIndex)