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 <K> boolean isEquals(Collection<K> collection1, Collection<K> collection2) {

        if (collection1 == null && collection2 == null) {
            return true;
        }
        if (collection1 == null || collection2 == null || collection1.size() != collection2.size()) {
            return false;
        }
        boolean result = true;
        Iterator<K> ite2 = collection2.iterator();
        while (ite2.hasNext()) {
            if (!collection1.contains(ite2.next())) {
                result = false;
                break;
            }
        }
        return result;
    }
}