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;

import java.util.List;

public class Main {
    public static Collection leftDifference(final Collection c1, final Collection c2) {
        return rightDifference(c2, c1);
    }

    public static Collection rightDifference(final Collection c1, final Collection c2) {
        final List result = new ArrayList();
        final Object[] members_c1 = c1.toArray();
        for (int i = 0; i < members_c1.length; i++) {
            if (!c2.contains(members_c1[i])) {
                result.add(members_c1[i]);
            }
        }
        return result;
    }
}