Java Collection Add added(Collection a, Collection b)

Here you can find the source of added(Collection a, Collection b)

Description

returns the elements added in List a with respect to b

License

Open Source License

Parameter

Parameter Description
a list of element of type T
b list of element of type T

Return

list list of element of type T

Declaration

public static <T> Collection<T> added(Collection<T> a, Collection<T> b) 

Method Source Code

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

import java.util.ArrayList;

import java.util.Collection;

public class Main {
    /**/*from w  w  w  .j  av a  2s.c  om*/
     * returns the elements added in List a with respect to b
     * 
     * @param a list of element of type T
     * @param b list of element of type T
     * @return list list of element of type T
     */
    public static <T> Collection<T> added(Collection<T> a, Collection<T> b) {

        Collection<T> aCopy = new ArrayList<T>(a);
        Collection<T> bCopy = new ArrayList<T>(b);

        aCopy.removeAll(bCopy);
        return aCopy;
    }
}

Related

  1. addCollections(Collection... inCollections)
  2. addCondition(Collection conditions, String condition, double value)
  3. addConditionImpl(Collection conditions, String condition, String value)
  4. addDirToStringPaths(Collection ss, String dir)
  5. added(Collection old, Collection nu)
  6. addIf(Collection coll, T value, boolean expr)
  7. addIfAbsent(Collection c, T item)
  8. addIfMissing(Collection result, Iterable addition)
  9. addIfNotContains(Collection collection, T value)