Here you can find the source of concatenate(List
static <T> List<T> concatenate(List<T> a, List<T> b)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import java.util.Collections; import java.util.List; public class Main { /** The given lists are not modified. */ static <T> List<T> concatenate(List<T> a, List<T> b) { if (a.isEmpty()) { return b; }/*from ww w . j a v a 2 s .c o m*/ if (b.isEmpty()) { return a; } List<T> l = new ArrayList<>(a.size() + b.size()); l.addAll(a); l.addAll(b); return Collections.unmodifiableList(l); } }