@Test public void testListMinus() { List<String> minuend = Arrays.asList(new String[]{"1", "2", "3", "6", "8"}); List<String> extraction = Arrays.asList(new String[]{"6", "8", "9"}); List<String> results = CollectionUtils.listMinus(minuend, extraction); Assert.assertEquals(3, results.size()); }
@SuppressWarnings("hiding") public static <T> List<T> listMinus(List<T> minuend, List<T> extraction) { List<T> results = new ArrayList<T>(); if (minuend == null) { return results; } if (extraction == null || extraction.isEmpty()) { results.addAll(minuend); return results; } for (T t : minuend) { if (collectionContains(extraction, t)) { } else { results.add(t); } } return results; }
CollectionUtils { @SuppressWarnings("hiding") public static <T> List<T> listMinus(List<T> minuend, List<T> extraction) { List<T> results = new ArrayList<T>(); if (minuend == null) { return results; } if (extraction == null || extraction.isEmpty()) { results.addAll(minuend); return results; } for (T t : minuend) { if (collectionContains(extraction, t)) { } else { results.add(t); } } return results; } }
CollectionUtils { @SuppressWarnings("hiding") public static <T> List<T> listMinus(List<T> minuend, List<T> extraction) { List<T> results = new ArrayList<T>(); if (minuend == null) { return results; } if (extraction == null || extraction.isEmpty()) { results.addAll(minuend); return results; } for (T t : minuend) { if (collectionContains(extraction, t)) { } else { results.add(t); } } return results; }  }
CollectionUtils { @SuppressWarnings("hiding") public static <T> List<T> listMinus(List<T> minuend, List<T> extraction) { List<T> results = new ArrayList<T>(); if (minuend == null) { return results; } if (extraction == null || extraction.isEmpty()) { results.addAll(minuend); return results; } for (T t : minuend) { if (collectionContains(extraction, t)) { } else { results.add(t); } } return results; }  @SuppressWarnings("hiding") static List<T> listMinus(List<T> minuend, List<T> extraction); static boolean collectionContains(Collection<?> list, Object t); static Map<K, V> asMap(Collection<V> list, Function<? super V, K> keyFunction); static List<E> getOrCreateArrayList(Map<K, List<E>> map, K key); static Map<K, V> getOrCreateHashMap(Map<T, Map<K, V>> map, T key); static void putToMap(Map<K, V> targetMap, List<V> addingList, Function<? super V, K> keyMapper); static void putToSet(Set<K> targetMap, Collection<V> addingList, Function<? super V, K> keyMapper); static List<G> groupUp(List<G> groups, List<E> elements, Function<? super G, Object> keyMapperOfGroup,
            Function<? super G, List<E>> childrenMapperOfGroup, Function<? super E, Object> parentMapperOfElement); static E pickRandomOne(List<E> collection); static E pickLastOne(List<E> collection, Comparator<E> comparator); static Map<K, V> zipToMap(List<K> keys, List<V> values); }
CollectionUtils { @SuppressWarnings("hiding") public static <T> List<T> listMinus(List<T> minuend, List<T> extraction) { List<T> results = new ArrayList<T>(); if (minuend == null) { return results; } if (extraction == null || extraction.isEmpty()) { results.addAll(minuend); return results; } for (T t : minuend) { if (collectionContains(extraction, t)) { } else { results.add(t); } } return results; }  @SuppressWarnings("hiding") static List<T> listMinus(List<T> minuend, List<T> extraction); static boolean collectionContains(Collection<?> list, Object t); static Map<K, V> asMap(Collection<V> list, Function<? super V, K> keyFunction); static List<E> getOrCreateArrayList(Map<K, List<E>> map, K key); static Map<K, V> getOrCreateHashMap(Map<T, Map<K, V>> map, T key); static void putToMap(Map<K, V> targetMap, List<V> addingList, Function<? super V, K> keyMapper); static void putToSet(Set<K> targetMap, Collection<V> addingList, Function<? super V, K> keyMapper); static List<G> groupUp(List<G> groups, List<E> elements, Function<? super G, Object> keyMapperOfGroup,
            Function<? super G, List<E>> childrenMapperOfGroup, Function<? super E, Object> parentMapperOfElement); static E pickRandomOne(List<E> collection); static E pickLastOne(List<E> collection, Comparator<E> comparator); static Map<K, V> zipToMap(List<K> keys, List<V> values);  }