Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

public class Main {
    public static <T> boolean doCompare(Collection<T> c1, Collection<T> c2) {

        if (c1 == null && c2 == null) {
            return true;
        }

        if (c1 == null || c2 == null) {
            return false;
        }

        if (c1.size() != c2.size()) {
            return false;
        }

        Iterator<T> it = c1.iterator();
        while (it.hasNext()) {
            if (!c2.contains(it.next())) {
                return false;
            }
        }

        return true;
    }
}