List of utility methods to do ArrayList Remove
void | removeIndex(ArrayList arr, ArrayList idNames) remove all the relation index for the input array for (Object item : arr) { if (item instanceof ArrayList) { removeIndex((ArrayList) item, idNames); } else if (item instanceof HashMap) { removeIndex((HashMap) item, idNames); |
List | removeLastValues(final ArrayList The Method removeLastValues(ArrayList, int) remove the last Values. if (remove < v.size()) { final List<T> l = v.subList(remove, v.size()); return l; throw new IllegalArgumentException("You cannot remove " + "more element than in the ArrayList exists. \nSize from ArrayList:" + v.size() + "\n" + "Elements to be removed:" + remove + "\n The same ArrayList will be returned."); |
void | removeNulls(ArrayList remove Nulls int pos = 0; for (int i = 0; i < list.size(); i++) { E current = list.get(i); if (current != null) { if (i != pos) { list.set(pos, current); pos++; ... |
ArrayList | removeRepeatedElems(ArrayList list) Removes any repeated elements from the input ArrayList; returns a new ArrayList containing all unique elements from the input list. ArrayList newList = new ArrayList(); iLoop: for (int i = 0; i < list.size(); i++) { String str = (String) (list.get(i)); for (int j = 0; j < newList.size(); j++) { if (str.equals((String) (newList.get(j)))) { continue iLoop; newList.add(str); return newList; |