Java examples for java.util:List Operation
compare two Lists
//package com.java2s; import java.util.List; public class Main { public static void main(String[] argv) { List one = java.util.Arrays.asList("asdf", "java2s.com"); List another = java.util.Arrays.asList("asdf", "java2s.com"); System.out.println(compareList(one, another)); }/*from w ww. j a v a 2 s .co m*/ public static boolean compareList(List<?> one, List<?> another) { if (one == null && another == null) { return true; } else if (one != null && another != null) { if (one.containsAll(another) && another.containsAll(one)) { return true; } } return false; } }