Java List Subtract subtract(List aList, List bList)

Here you can find the source of subtract(List aList, List bList)

Description

subtract

License

Open Source License

Declaration

public static <T> List<T> subtract(List<T> aList, List<T> bList) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;
import java.util.List;

public class Main {
    public static <T> List<T> subtract(List<T> aList, List<T> bList) {
        List<T> result = new ArrayList<T>();
        for (T t : aList) {
            if (!bList.contains(t)) {
                result.add(t);//from  ww  w.  ja  v a  2 s.com
            }
        }
        return result;
    }
}

Related

  1. subtract(final List result, final Object o1, final Object o2)
  2. subtract(final String[] input, final String[] list)
  3. subtract(List a, List b)
  4. subtract(List vector, int[] sparseVector)
  5. subtract(List a, List b)
  6. subtract(String[] list1, String[] list2)
  7. subtractAsList(T[] array1, T[] array2)
  8. subtractFloatLists(List listA, List listB)
  9. subtractFromList(List op1, Object op2)