Java tutorial
//package com.java2s; import java.util.Collection; public class Main { public static boolean isOverlap(Collection<?> list1, Collection<?> list2) { if (list1 == list2) { return true; } if (list1 == null || list2 == null) { return false; } for (Object element : list1) { if (list2.contains(element)) { return true; } } return false; } }