Java examples for java.util:List Operation
filter a List from a String Array
//package com.java2s; import java.util.List; public class Main { public static void main(String[] argv) { String[] strs = new String[] { "1", "abc", "level", null, "java2s.com", "asdf 123" }; List list = java.util.Arrays.asList("asdf", "java2s.com"); System.out.println(filter(strs, list)); }//from w w w .ja va2 s . c o m public static List filter(String[] strs, List list) { for (int i = 0; i < strs.length; i++) { while (list.contains(strs[i])) list.remove(strs[i]); } return list; } }