forked from janbodnar/Java-Advanced
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAddAll.java
More file actions
31 lines (21 loc) · 667 Bytes
/
AddAll.java
File metadata and controls
31 lines (21 loc) · 667 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package com.zetcode;
import java.util.ArrayList;
import java.util.List;
public class AddAll {
public static void main(String[] args) {
List<String> colours1 = new ArrayList<>();
colours1.add("blue");
colours1.add("red");
colours1.add("green");
List<String> colours2 = new ArrayList<>();
colours2.add("yellow");
colours2.add("pink");
colours2.add("brown");
List<String> colours3 = new ArrayList<>();
colours3.add("white");
colours3.add("orange");
colours3.addAll(colours1);
colours3.addAll(2, colours2);
System.out.println(colours3);
}
}