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[]removeFlagsFromArgs(String[] args)
remove Flags From Args
List<String> ret = new ArrayList<String>();
boolean removeNextArg = false;
for (String argument : args) {
    if (argument.equals("-a")) {
        removeNextArg = true;
        continue;
    if (removeNextArg) {
...
double[]removeFrom(double[] source, int idx)
Remove a the item at the given index from the array.
double[] rslt = Arrays.copyOf(source, source.length - 1);
System.arraycopy(source, idx + 1, rslt, idx, source.length - idx - 1);
return rslt;
String[]removeFromArray(String remove, String array[])
Remove every element that matches a string from an array.
ArrayList<String> returnValues = new ArrayList<>();
for (String value : array) {
    if (!value.equals(remove)) {
        returnValues.add(value);
return returnValues.toArray(new String[returnValues.size()]);
String[]removeFromArray(String[] oldArray, String stringToRemove)
remove From Array
List<String> list = new ArrayList<String>(Arrays.asList(oldArray));
list.remove(stringToRemove);
return list.toArray(new String[0]);
byte[]removeId(byte[] in, Integer id)
remove Id
byte[] out = null;
if (in != null) {
    String[] idArr = (new String(in)).split(",");
    List<String> idList = new ArrayList<String>(Arrays.asList(idArr));
    if (idList.remove(id.toString()) && idList.size() > 0) {
        String idStr = idList.toString().replaceAll("\\[", "").replaceAll("\\]", "").replaceAll(" ", "")
                .trim();
        out = idStr.getBytes();
...
String[]removeIndex(String[] args, int index)
remove Index
List<String> list = new ArrayList<>(Arrays.asList(args));
list.remove(index);
String[] newArgs = new String[list.size()];
return list.toArray(newArgs);
T[]removeIndex(T[] array, int index)
Returns a copy of the given array, with the element at the given index removed.
return removeIndex(array, index, false);
byte[]removeLast(byte[] target, int end)
remove Last
return Arrays.copyOfRange(target, 0, end);
int[]removeLowScore(int[] array)
remove Low Score
int low = findLowPos(array);
ArrayList<Integer> outList = new ArrayList<Integer>();
for (int i : array)
    if (i != low)
        outList.add(i);
outList.trimToSize();
int[] outArray = new int[outList.size()];
for (int i = 0; i < outArray.length; i++)
...
String[]removeMethodsOption(String[] args)
Searches in args for the String #METHODS_OPTION and removes it.
ArrayList list = new ArrayList(args.length);
for (int i = 0; i < args.length; i++) {
    list.add(args[i]);
return (String[]) list.toArray(new String[list.size()]);