Open DrMaemi opened 11 months ago
List<String> list = Arrays.asList("a", "b", "c"); List<String> arrList = new ArrayList<>(list);
List<String> list = List.of("a", "b", "c"); List<String> arrList = new ArrayList<>(list);
ArrayList<String> arrList = new ArrayList<String>() {{ add("apple"); add("grape"); add("banana"); add("kiwi"); }};
String[] arr = new String[] { "apple", "grape", "banana", "kiwi" }; ArrayList<String> arrList = new ArrayList<>(Stream.of(arr) .collect(Collectors.toList()));
1. Arrays.asList("a", "b", "c")
2. List.of("a", "b", "c")
3. Double brace initialization
4. Stream.of(String[])
A. 참조