Java ArrayList Remove removeAllFromArrayList(ArrayList collection, Collection toRemove)

Here you can find the source of removeAllFromArrayList(ArrayList collection, Collection toRemove)

Description

remove All From Array List

License

Open Source License

Declaration

private static <T> boolean removeAllFromArrayList(ArrayList<T> collection, Collection<?> toRemove) 

Method Source Code

//package com.java2s;

import java.util.ArrayList;
import java.util.Collection;

public class Main {
    private static <T> boolean removeAllFromArrayList(ArrayList<T> collection, Collection<?> toRemove) {
        boolean result = false;
        for (int i = collection.size(); --i >= 0;)
            if (toRemove.contains(collection.get(i))) {
                collection.remove(i);//from  w w w .j  a va 2s . co m
                result = true;
            }
        return result;
    }
}

Related

  1. removeAdditionalRanges(String line, ArrayList indices, ArrayList newRanges)
  2. removeAllListaProd(ArrayList lista)
  3. removeAlreadyParsedFolders(ArrayList listStrings, String pickup, String limit)
  4. removeByReference(ArrayList list, T object)
  5. removeDuplicates(ArrayList al)