Java Utililty Methods List Remove

List of utility methods to do List Remove

Description

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

Method

ListremoveEmptyValues(final List values)
Remove empty (length zero when trimmed) values from a list.
if (values == null) {
    return null;
final List<String> result = new ArrayList<String>(values.size());
for (String value : values) {
    if (!(value.trim().length() == 0)) {
        result.add(value);
return result;
voidremoveFrom(List col, int from)
remove From
for (int i = col.size() - 1; i > from; i--)
    col.remove(i);
ListremoveFrom(List list, T member)
remove From
List<T> newList = new ArrayList<T>(list);
newList.remove(member);
return newList;
String[]removeFromArray(String[] fieldList, String exludeElement)
For removing specified value from a array.
String[] newList = new String[fieldList.length - 1];
List<String> oldList = null;
int j = 0;
oldList = Arrays.asList(fieldList);
if (!oldList.contains(exludeElement)) {
    return fieldList;
for (int i = 0; i < fieldList.length; i++) {
...
voidremoveFromListByClass(final List list, final String className)
remove From List By Class
removeFromListByClass(list, className, false);
voidremoveFromListMap(T key, U value, Map> map)
Remove an element from a map whose values are lists of elements.
List<U> list = map.get(key);
if (list == null)
    return;
list.remove(value);
if (list.isEmpty())
    map.remove(key);
ListremoveIgnoreCase(List l, String s)
remove Ignore Case
Iterator<String> iter = l.iterator();
while (iter.hasNext()) {
    if (iter.next().equalsIgnoreCase(s)) {
        iter.remove();
        break;
return l;
...
ListremoveIgnoreCase(String needle, List haystack)
remove Ignore Case
int index = findIgnoreCase(needle, haystack);
if (index >= 0)
    haystack.remove(index);
return haystack;
ListremoveItems(List list, T... remove)
Removes items from a list and returns that same list.
if (isEmpty(list))
    return null;
list.removeAll(Arrays.asList(remove));
return list;
voidremoveList(List l)
remove List
for (int i = 0; i < l.size(); i++) {
    String s = l.get(i);
    char c = s.charAt(s.length() - 1);
    if (c == '1' || c == '2' || c == '3' || c == '4' || c == '5' || c == '6' || c == '7' || c == '8'
            || c == '9' || c == '0') {
        l.remove(i);
        i = 0;