@Test public void removeAllByStrWithSeparator() { assertEquals(Collections.singletonList("bbb"), CollectionUtils.removeAllByStrWithSeparator(Arrays.asList("aaa", "abc", "bbb"), "a,c", ",")); assertEquals(Collections.singletonList("bbb"), CollectionUtils.removeAllByStrWithSeparator(Arrays.asList("aaa", "abc", "bbb"), "a", ",")); assertEquals(Arrays.asList("aaa", "bbb"), CollectionUtils.removeAllByStrWithSeparator(Arrays.asList("aaa", "abc", "bbb"), "c", ",")); assertEquals(Collections.emptyList(), CollectionUtils.removeAllByStrWithSeparator(Arrays.asList("aaa", "abc", "bbb"), "", ",")); assertEquals(Collections.singletonList(""), CollectionUtils.removeAllByStrWithSeparator(Collections.singletonList(""), "a", ",")); }
public static List<String> removeAllByStrWithSeparator(List<String> originList, String strWithSeparator, String separator) { if (originList == null || originList.size() <= 0 || strWithSeparator == null || separator == null) return null; List<String> result = new LinkedList<>(); boolean isContains; for (String origin : originList) { isContains = false; for (String aim : strWithSeparator.split(separator)) if (!isContains && origin.contains(aim)) isContains = true; if (!isContains) result.add(origin); } return result; }
CollectionUtils { public static List<String> removeAllByStrWithSeparator(List<String> originList, String strWithSeparator, String separator) { if (originList == null || originList.size() <= 0 || strWithSeparator == null || separator == null) return null; List<String> result = new LinkedList<>(); boolean isContains; for (String origin : originList) { isContains = false; for (String aim : strWithSeparator.split(separator)) if (!isContains && origin.contains(aim)) isContains = true; if (!isContains) result.add(origin); } return result; } }
CollectionUtils { public static List<String> removeAllByStrWithSeparator(List<String> originList, String strWithSeparator, String separator) { if (originList == null || originList.size() <= 0 || strWithSeparator == null || separator == null) return null; List<String> result = new LinkedList<>(); boolean isContains; for (String origin : originList) { isContains = false; for (String aim : strWithSeparator.split(separator)) if (!isContains && origin.contains(aim)) isContains = true; if (!isContains) result.add(origin); } return result; } private  CollectionUtils(); }
CollectionUtils { public static List<String> removeAllByStrWithSeparator(List<String> originList, String strWithSeparator, String separator) { if (originList == null || originList.size() <= 0 || strWithSeparator == null || separator == null) return null; List<String> result = new LinkedList<>(); boolean isContains; for (String origin : originList) { isContains = false; for (String aim : strWithSeparator.split(separator)) if (!isContains && origin.contains(aim)) isContains = true; if (!isContains) result.add(origin); } return result; } private  CollectionUtils(); static List<String> removeAllByStrWithSeparator(List<String> originList,
                                                           String strWithSeparator, String separator); static Object[] intersection(Object[] a, Object[] b); static Collection<T> intersection(Collection<T> a, Collection<T> b); static Object getDuplicate(Collection<E> coll, E o, String field, Class fieldClass); static Object getDuplicate(Collection<E> coll, E o, String fieldName,
                                          Class fieldClass, Class elementClass); static Collection<T> remove(Collection<T> coll, final String field, final Object... removes); static int getNthNumberMin(int[] arr, int n); static int getNthNumberMax(int[] arr, int n); static Map<Y, Map<X, Z>> exchangeKeys(Map<X, Map<Y, Z>> map); static String join(T[] arr, String separator); static String join(Collection<T> list, String separator); }
CollectionUtils { public static List<String> removeAllByStrWithSeparator(List<String> originList, String strWithSeparator, String separator) { if (originList == null || originList.size() <= 0 || strWithSeparator == null || separator == null) return null; List<String> result = new LinkedList<>(); boolean isContains; for (String origin : originList) { isContains = false; for (String aim : strWithSeparator.split(separator)) if (!isContains && origin.contains(aim)) isContains = true; if (!isContains) result.add(origin); } return result; } private  CollectionUtils(); static List<String> removeAllByStrWithSeparator(List<String> originList,
                                                           String strWithSeparator, String separator); static Object[] intersection(Object[] a, Object[] b); static Collection<T> intersection(Collection<T> a, Collection<T> b); static Object getDuplicate(Collection<E> coll, E o, String field, Class fieldClass); static Object getDuplicate(Collection<E> coll, E o, String fieldName,
                                          Class fieldClass, Class elementClass); static Collection<T> remove(Collection<T> coll, final String field, final Object... removes); static int getNthNumberMin(int[] arr, int n); static int getNthNumberMax(int[] arr, int n); static Map<Y, Map<X, Z>> exchangeKeys(Map<X, Map<Y, Z>> map); static String join(T[] arr, String separator); static String join(Collection<T> list, String separator);  }