Here you can find the source of concat(List
public static <T> List<T> concat(List<T> l1, List<T> l2)
//package com.java2s; import java.util.ArrayList; import java.util.List; public class Main { public static <T> List<T> concat(List<T> l1, List<T> l2) { int size1 = l1.size(); if (size1 == 0) { return l2; }//w ww . j ava 2s.c om int size2 = l2.size(); if (size2 == 0) { return l1; } List<T> l3 = new ArrayList<T>(size1 + size2); l3.addAll(l1); l3.addAll(l2); return l3; } }