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[]removeElementInStringArray(String[] array, int index)
Remove element element with index on array
List<String> result = new ArrayList<String>();
for (int i = 0; i < array.length; i++) {
    if (i != index) {
        result.add(array[i]);
if (result.size() < 1)
    return null;
...
String[]removeEmpties(String[] array)
remove Empties
if (array == null)
    return new String[0];
ArrayList returnValues = new ArrayList(array.length);
for (int i = 0; i < array.length; i++) {
    if (array[i] != null && !array[i].equals(""))
        returnValues.add(array[i]);
return (String[]) (returnValues.toArray(new String[returnValues.size()]));
...
String[]removeEmtpyStrings(String[] strings)
Remove all empty/null Strings from the array.
ArrayList<String> res = new ArrayList<String>();
for (String string : strings)
    if (!(string == null || string.equals("")))
        res.add(string);
return res.toArray(new String[res.size()]);
String[]removeFirst(String[] args)
Removes first item from a string array
List<String> out = fromArray(args);
if (!out.isEmpty()) {
    out.remove(0);
return toArray(out);
String[]removeFirst(String[] array)
remove First
List<String> newStrings = new ArrayList<String>();
for (int i = 0; i + 1 < array.length; i++) {
    newStrings.add(array[i + 1]);
return newStrings.toArray(new String[0]);
String[]removeFirst(String[] in)
Returns a copy of in, but without the first element.
if (in.length == 0) {
    return new String[0];
return Arrays.copyOfRange(in, 1, in.length);
String[]removeFirst(String[] strArr)
remove First
if (strArr.length == 0) {
    return null;
return Arrays.copyOfRange(strArr, 1, strArr.length);
T[]removeFirstElementFromArray(T[] array)
remove First Element From Array
return Arrays.copyOfRange(array, 1, array.length);
ListremoveFirstTwoArgs(String[] args, int startIndex)
remove First Two Args
List<String> convertedString = new ArrayList<>();
for (int i = startIndex; i < args.length; i++)
    convertedString.add(args[i]);
return convertedString;
booleanremoveFlag(String[] options, String flag)
Checks whether the flag is in the option string and removes the flag if present.
boolean result;
int i;
result = false;
for (i = 0; i < options.length; i++) {
    if (options[i].equals(flag)) {
        options[i] = "";
        result = true;
        break;
...