Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.ArrayList;
import java.util.Collection;

public class Main {
    public static <T> Collection<T> setDiff(Collection<T> itemsToStartWith, Collection<T> itemsToSubtract) {
        Collection<T> retval = new ArrayList<T>();
        if (itemsToStartWith == null)
            return new ArrayList<T>();
        retval.addAll(itemsToStartWith); // make copy so you don't mutate original
        if (itemsToSubtract != null)
            retval.removeAll(itemsToSubtract);
        return retval;
    }
}