Here you can find the source of containsAtLeastOne(Collection origin, Collection elements)
Parameter | Description |
---|---|
origin | - origin collection |
elements | - another collection |
public static boolean containsAtLeastOne(Collection origin, Collection elements)
//package com.java2s; //License from project: LGPL import java.util.*; public class Main { /** Return true if origin collection contains at least one element from another collection * @param origin - origin collection * @param elements - another collection *///from w ww. ja v a 2s. c om public static boolean containsAtLeastOne(Collection origin, Collection elements) { boolean result = false; for (Object element : elements) { if (origin.contains(element)) { result = true; break; } } return result; } }