Android examples for java.util:Collection Contains
Check if a collection contains Any elements from another Collection
//package com.book2s; import java.util.Collection; public class Main { public static void main(String[] argv) { Collection container = java.util.Arrays .asList("asdf", "book2s.com"); Collection dataToCheck = java.util.Arrays.asList("asdf", "book2s.com"); System.out.println(containAny(container, dataToCheck)); }/* ww w.j a va2 s .c o m*/ public static <T> boolean containAny(Collection<T> container, Collection<T> dataToCheck) { for (T e : dataToCheck) { if (container.contains(e)) { return true; } } return false; } }