Is there a way to add multiple strings to List<String>
in a single command?
I know a way of populating list
as list.add("string")
, but
is there something like list.add("string1","string2")
?
Is there a way to add multiple strings to List<String>
in a single command?
I know a way of populating list
as list.add("string")
, but
is there something like list.add("string1","string2")
?
Yes there is like:
List<Integer> myList = new ArrayList<>();
myList.addAll(Arrays.asList("string1","string2"));