Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.Collection; public class Main { public static boolean nonEmptyIntersection(Collection<? extends Object> collection1, Collection<? extends Object> collection2) { for (Object obj : collection1) { if (collection2.contains(obj)) { return true; } } return false; } }