Returns whether two collections have any elements in common.
(Collection<E> c0, Collection<E> c1)
| 2400 | |
| 2401 | /** Returns whether two collections have any elements in common. */ |
| 2402 | public static <E> boolean intersects(Collection<E> c0, Collection<E> c1) { |
| 2403 | for (E e : c1) { |
| 2404 | if (c0.contains(e)) { |
| 2405 | return true; |
| 2406 | } |
| 2407 | } |
| 2408 | return false; |
| 2409 | } |
| 2410 | |
| 2411 | /** Looks for a string within a list of strings, using a given |
| 2412 | * case-sensitivity policy, and returns the position at which the first match |