Here you can find the source of intersectsWith(Collection> S1, Collection> S2)
Parameter | Description |
---|---|
S1 | S1 |
S2 | S2 |
public static boolean intersectsWith(Collection<?> S1, Collection<?> S2)
//package com.java2s; /* This file is part of the JFact DL reasoner Copyright 2011-2013 by Ignazio Palmisano, Dmitry Tsarkov, University of Manchester This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA*/ import java.util.Collection; public class Main { /**//from ww w . j a v a 2s . c o m * check whether set S1 intersects with the set S2 * * @param S1 * S1 * @param S2 * S2 * @return true if S1 and S2 intersect */ public static boolean intersectsWith(Collection<?> S1, Collection<?> S2) { for (Object o : S1) { if (S2.contains(o)) { return true; } } return false; } }