### Question:
CollectionUtils { public static <T extends Collection> T constructCollectionByType(Class collectionType) { if (Set.class.isAssignableFrom(collectionType)) { return (T) new HashSet(); } else if (List.class.isAssignableFrom(collectionType)) { return (T) new ArrayList(); } else { return null; } }  static LinkedList<Object> toLinkedList(Object[] array); static boolean contains(Collection collection, Class clazz); static Object getFirstMatch(Object[] collection, Class clazz); static Object getFirstMatch(List collection, Class clazz); static Map<Object, Collection> classify(Collection<T> srcCollection, ClassifyFilter classifyFilter); static T constructCollectionByType(Class collectionType); static Collection<T> sortCollection(Collection<T> collection, Comparator<T> comparator);  }### Answer:
@Test public void testConstructByType() { Assertions.assertDoesNotThrow(() -> { List list = CollectionUtils.constructCollectionByType(List.class); Assertions.assertNotNull(list); Set set = CollectionUtils.constructCollectionByType(Set.class); Assertions.assertNotNull(set); }); }