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

Listremove(Collection entityList1, Collection entityList2, Comparator comparator)
remove
List result = new ArrayList();
for (Iterator iter1 = entityList1.iterator(); iter1.hasNext();) {
    Object o1 = iter1.next();
    boolean containedOnList2 = false;
    for (Iterator iter2 = entityList2.iterator(); iter2.hasNext();) {
        Object o2 = iter2.next();
        if (comparator.compare(o1, o2) == 0) {
            containedOnList2 = true;
...
Tremove(final List list, final int index, final T defaultValue)
remove
return index < list.size() ? list.remove(index) : defaultValue;
Listremove(final List list, final T... objects)
Removes the.
for (final T object : objects)
    list.remove(object);
return list;
booleanremove(List aList, Object anObj)
Removes given object from given list (accepts null list).
return aList == null ? false : aList.remove(anObj);
voidremove(List models, int start, int count)
remove
models.subList(start, start + count).clear();
Listremove(List list, List elements)
remove
final ArrayList<T> result = new ArrayList<T>(list);
result.removeAll(elements);
return result;
voidremove(List list, Class type)
remove
for (Iterator<?> it = list.iterator(); it.hasNext();) {
    Object item = it.next();
    if (type.isInstance(item)) {
        it.remove();
Listremove(List as, int start, int end)
remove
List<A> result = new ArrayList<A>(as.subList(start, end));
for (int i = 0; i < end - start; i++)
    as.remove(start);
return result;
booleanremove(List list, E element)
remove
Iterator<E> itr = list.iterator();
while (itr.hasNext()) {
    E curElement = itr.next();
    if ((curElement == element) || curElement.equals(element)) {
        itr.remove();
        return true;
return false;
voidremove(List list, E object)
Removes the given object from the given list, comparing each element in the list with equals.
for (Iterator<E> it = list.iterator(); it.hasNext();) {
    if (it.next().equals(object)) {
        it.remove();