@Test public void testToUpperList() { List<String> sourceList = null; Assertions.assertNull(CollectionUtils.toUpperList(sourceList)); sourceList = new ArrayList<>(); Assertions.assertEquals(Collections.EMPTY_LIST, CollectionUtils.toUpperList(sourceList)); List<String> anotherList = new ArrayList<>(); sourceList.add("a"); anotherList.add("A"); sourceList.add("b"); anotherList.add("b"); sourceList.add("c"); anotherList.add("C"); Assertions.assertEquals(CollectionUtils.toUpperList(sourceList), CollectionUtils.toUpperList(anotherList)); anotherList.add("D"); Assertions.assertTrue( CollectionUtils.toUpperList(anotherList).containsAll(CollectionUtils.toUpperList(sourceList))); }
public static List<String> toUpperList(List<String> sourceList) { if (null == sourceList || sourceList.size() == 0) { return sourceList; } List<String> destList = new ArrayList<>(sourceList.size()); for (String element : sourceList) { if (null != element) { destList.add(element.toUpperCase()); } else { destList.add(element); } } return destList; }
CollectionUtils { public static List<String> toUpperList(List<String> sourceList) { if (null == sourceList || sourceList.size() == 0) { return sourceList; } List<String> destList = new ArrayList<>(sourceList.size()); for (String element : sourceList) { if (null != element) { destList.add(element.toUpperCase()); } else { destList.add(element); } } return destList; } }
CollectionUtils { public static List<String> toUpperList(List<String> sourceList) { if (null == sourceList || sourceList.size() == 0) { return sourceList; } List<String> destList = new ArrayList<>(sourceList.size()); for (String element : sourceList) { if (null != element) { destList.add(element.toUpperCase()); } else { destList.add(element); } } return destList; }  }
CollectionUtils { public static List<String> toUpperList(List<String> sourceList) { if (null == sourceList || sourceList.size() == 0) { return sourceList; } List<String> destList = new ArrayList<>(sourceList.size()); for (String element : sourceList) { if (null != element) { destList.add(element.toUpperCase()); } else { destList.add(element); } } return destList; }  static boolean isEmpty(Collection col); static boolean isNotEmpty(Collection col); static boolean isEmpty(Object[] array); static boolean isNotEmpty(Object[] array); static String toString(Collection col); static boolean isSizeEquals(Collection col0, Collection col1); static String encodeMap(Map<String, String> map); static Map<String, String> decodeMap(String data); static List<String> toUpperList(List<String> sourceList); }
CollectionUtils { public static List<String> toUpperList(List<String> sourceList) { if (null == sourceList || sourceList.size() == 0) { return sourceList; } List<String> destList = new ArrayList<>(sourceList.size()); for (String element : sourceList) { if (null != element) { destList.add(element.toUpperCase()); } else { destList.add(element); } } return destList; }  static boolean isEmpty(Collection col); static boolean isNotEmpty(Collection col); static boolean isEmpty(Object[] array); static boolean isNotEmpty(Object[] array); static String toString(Collection col); static boolean isSizeEquals(Collection col0, Collection col1); static String encodeMap(Map<String, String> map); static Map<String, String> decodeMap(String data); static List<String> toUpperList(List<String> sourceList);  }