June 2018
Beginner
722 pages
18h 47m
English
In the Constructor subsection, we demonstrated how the List<T> Arrays.asList(T...a) method can be used to generate a list of values, which can then be passed in a constructor of any class that implements the Collection interface (or any interface that extends the Collection, such as List and Set, for example). As a reminder, we would like to mention that the (T...a) notation is called varargs and means that the parameter can be passed in any of the following two ways:
So, both the following statements create equal lists:
List<String> x1 = Arrays.asList(null, "s2", "s3");String[] array = {null, "s2", "s3"};List<String> ...
Read now
Unlock full access