0 votes
1 view
in Java by (2.8k points)

Here are the conditions: do not modify the original lists; JDK only, no external libraries.one-liner or a JDK 1.3 version is preferred. 

Is there a simpler way than:

List<String> newList = new ArrayList<String>();

newList.addAll(listOne);

newList.addAll(listTwo);

1 Answer

0 votes
by (21.1k points)

Here's one linear which fulfills all the conditions mentioned by you:

List<String> newList = new ArrayList<String>(listOne);

newList.addAll(listTwo);

click here to read more about it.

...