Here you can find the source of compareStringLists(List
Parameter | Description |
---|---|
elements1 | a parameter |
elements2 | a parameter |
public static boolean compareStringLists(List<String> elements1, List<String> elements2)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { /**/*ww w.j a va 2s.co m*/ * Compare two array lists, if any of the elements in elements1 matches to * either one of the element in elements2, return true else return false. * * @param elements1 * @param elements2 * @return */ public static boolean compareStringLists(List<String> elements1, List<String> elements2) { for (String element1 : elements1) { for (String element2 : elements2) { if (element1.equals(element2)) { return true; } } } return false; } }