Here you can find the source of intersect(Collection> collection, Collection> otherCollection)
protected static boolean intersect(Collection<?> collection, Collection<?> otherCollection)
//package com.java2s; /*/*from w w w .ja v a2 s . c om*/ * Copyright (c) 2005, 2014 IBM Corporation, Embarcadero Technologies, CEA, and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM - initial API and implementation * Kenn Hussey (Embarcadero Technologies) - 204200, 247980 * Keith Campbell (IBM) - 343783 * Kenn Hussey (CEA) - 316165, 322715, 212765, 421756, 424568 * Christian W. Damus (CEA) - 405065 * */ import java.util.Collection; import java.util.Collections; public class Main { protected static boolean intersect(Collection<?> collection, Collection<?> otherCollection) { return !Collections.disjoint(collection, otherCollection); } }