hendrichfer1351 hendrichfer1351
  • 14-09-2017
  • Computers and Technology
contestada

Suppose arraylist list1 is [1, 2, 5] and arraylist list2 is [2, 3, 6]. after list1.addall(list2), list1 is __________.

Respuesta :

kaevras
kaevras kaevras
  • 14-09-2017
the addAll(Collection c) method, simply appends c's elements to the end of the collection that the method was called from.

for example:


List<int> list1 =  new ArrayList<>(Arrays.asList(1, 2, 5));
List<int> list2 =  new ArrayList<>(Arrays.asList(2, 3, 6));
list1.addAll(list2);

for (int num : list1) {
    System.out.print(num + " ");
}


The output of the above code-snippet is: 1 2 5 2 3 6
Answer Link

Otras preguntas

how do fossils show evidence of the changing surface of the Earth?
True or False: Diagonals of a trapezoid are congruent.
Make 92 one thousand times smaller.
Mixing 4 ml of red paint and 15 ml yellow paint makes orange paint. How much red would be needed if you use 100 ml of yellow paint? Please show work
True or False: Diagonals of a trapezoid are congruent.
How do I do number 9? And can you please show work on paper
A room is 8.5 m long,6.5 m broad and 3.4 m high. It has two doors, each measuring (2 m 1m).Find the cost of painting its four walls at £160 per m.
Which type of economic activity requires extensive areas of land? A Industrial manufacturing B Commercial agriculture C Petroleum extraction D Retail business
Sum up 40 and 18,subtract therefrom 7.Then multiply with 8.
Scientists have discovered a new species of animal. Which would provide the best basis for classifying this new species? A DNA comparison B diet of animal