Collection<String> names = new ArrayList<>();
- Add one element
names.add("john");
System.out.println(names); //[john]
- Add multiple elements
names.addAll(List.of("james, harry"));
System.out.println(names); //[james, harry]
-----------------------------------------
… Read more Java collection cheat sheet
Reply
Copy image from https://viblo.asia/
For java_intermediate course. https://giangtester.com/khoa-hoc-java-intermediate/
I. Collection
is a “bag” = unordered listsNo direct implementation