Here you can find the source of added(Collection
Parameter | Description |
---|---|
a | list of element of type T |
b | list of element of type T |
public static <T> Collection<T> added(Collection<T> a, Collection<T> b)
//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; } }