Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

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

public class Main {
    @SuppressWarnings({ "rawtypes", "unchecked" })
    public static <T> Collection<T> substract(Collection<T> oldList, Collection<T> newList,
            java.util.Comparator comparator) {
        Collection<T> result = new ArrayList<T>(oldList);
        for (T oldValue : oldList) {
            for (T newValue : newList) {
                if (comparator.compare(oldValue, newValue) == 0) {
                    result.remove(oldValue);
                }
            }
        }
        return result;
    }
}