### Question:
CollectionUtils { public static <T extends Object> List<Map<String, Object>> getListByExclusion(List<T> originList, Set<String> exclusionSet) { List<Map<String, Object>> instanceList = new ArrayList<>(); if (exclusionSet == null) { exclusionSet = new HashSet<>(); } if (originList == null) { return instanceList; } Map<String, Object> instanceMap; for (T instance : originList) { Map<String, Object> dataMap = new BeanMap(instance); instanceMap = new LinkedHashMap<>(16, 0.75f, true); for (Map.Entry<String, Object> entry : dataMap.entrySet()) { if (exclusionSet.contains(entry.getKey())) { continue; } instanceMap.put(entry.getKey(), entry.getValue()); } instanceList.add(instanceMap); } return instanceList; } private  CollectionUtils(); static Collection<T> subtract(Set<T> a, Set<T> b); static boolean isNotEmpty(Collection coll); static boolean isEmpty(Collection coll); static Map<String, String> stringToMap(String str, String separator); static Map<String, String> stringToMap(String str, String separator, String keyPrefix); static boolean equalLists(Collection<?> a, Collection<?> b); static boolean isEqualCollection(final Collection<?> a, final Collection<?> b); static Map<O, Integer> getCardinalityMap(final Iterable<? extends O> coll); static List<Map<String, Object>> getListByExclusion(List<T> originList, Set<String> exclusionSet);  }### Answer:
@Test public void getListByExclusion() { Assert.assertNotNull(CollectionUtils.getListByExclusion(null, null)); List<Integer> originList = new ArrayList<>(); originList.add(1); originList.add(2); List<Map<String, Object>> ret = CollectionUtils.getListByExclusion(originList, null); Assert.assertEquals(2, ret.size()); ret = CollectionUtils.getListByExclusion(originList, new HashSet<>()); Assert.assertEquals(2, ret.size()); Assert.assertFalse(ret.get(0).isEmpty()); Set<String> exclusion = new HashSet<>(); exclusion.add(Constants.CLASS); ret = CollectionUtils.getListByExclusion(originList, exclusion); Assert.assertEquals(2, ret.size()); Assert.assertTrue(ret.get(0).isEmpty()); }