Here you can find the source of hasIntersection(List
public static boolean hasIntersection(List<String> list1, List<String> list2)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { public static boolean hasIntersection(List<String> list1, List<String> list2) { for (String str : list1) if (list2.contains(str)) return true; return false; }//from ww w . jav a2s . c o m }