Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Set;

public class Main {
    public static boolean intersects(Set<?> a, Set<?> b) {
        if (a.size() < b.size()) {
            for (Object obj : a) {
                if (b.contains(obj)) {
                    return true;
                }
            }
        } else {
            for (Object obj : b) {
                if (a.contains(obj)) {
                    return true;
                }
            }
        }
        return false;
    }
}