Here you can find the source of intersects(Collection c1, Collection c2)
Parameter | Description |
---|---|
coll | A Collection of sets |
public static boolean intersects(Collection c1, Collection c2)
//package com.java2s; //The MIT License import java.util.Collection; import java.util.Iterator; public class Main { /**//from w w w .ja va2s. c o m * Checks if two collections have any elemnts in common * * @param coll A Collection of sets */ public static boolean intersects(Collection c1, Collection c2) { for (Iterator i = c1.iterator(); i.hasNext();) { if (c2.contains(i.next())) return true; } return false; } }