Java Utililty Methods Array Remove

List of utility methods to do Array Remove

Description

The list of methods to do Array Remove are organized into topic(s).

Method

String[]removePointerFromDesc(String[] desc)
remove Pointer From Desc
ArrayList<String> tmp = new ArrayList<String>();
for (String s : desc) {
    if (!isPointerType(s.split(":")[1])) {
        tmp.add(s);
return tmp.toArray(new String[0]);
T[]removeRepeats(T[] array)
Removes any repeating data from the array
List<T> cache = new ArrayList<T>();
for (T o : array)
    if (!cache.contains(o))
        cache.add(o);
return cache.toArray(Arrays.copyOf(array, cache.size()));
int[][]removeRows(int[][] array, Collection rowsIndices)
remove Rows
int newLength = array.length - rowsIndices.size();
int[][] newArray = new int[newLength][];
ArrayList<Integer> listOfRows = new ArrayList<Integer>(rowsIndices);
Collections.sort(listOfRows);
int currentRowInNewArray = 0;
int currentIndexInArray = 0;
for (int i = 0; i < array.length; i++) {
    if (currentIndexInArray < listOfRows.size() && i == listOfRows.get(currentIndexInArray)) {
...
byte[]removeTrailing(final byte[] id)
remove Trailing
final int length = id.length;
if (length == 0) {
    return null;
return Arrays.copyOf(id, length - 1);
String[]removeUser(String[] array, String user)
remove User
if (array == null)
    return new String[0];
List<String> list = new ArrayList<String>(Arrays.asList(array));
if (list.contains(user)) {
    list.remove(user);
    return list.toArray(new String[list.size()]);
return array;
...
int[]removeValues(int[] values, int[] valuesToRemove)
removes all values in valuesToRemove array and shifts the remaining values to the left.
List<Integer> newValues = new ArrayList<Integer>();
for (int value : values) {
    if (!contains(valuesToRemove, value)) {
        newValues.add(value);
int[] newValuesArray = new int[newValues.size()];
for (int i = 0; i < newValues.size(); i++) {
...
byte[]removeZeros(int n, byte[] message)
remove Zeros
return Arrays.copyOfRange(message, n, message.length);