Here you can find the source of merge(Collection
public static <T> List<T> merge(Collection<T>... collections)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import java.util.Collection; import java.util.List; public class Main { public static <T> List<T> merge(Collection<T>... collections) { int size = 0; for (Collection collection : collections) { size += collection.size();/* ww w .j a va 2 s.co m*/ } ArrayList<T> ret = new ArrayList<T>(size); for (Collection collection : collections) { ret.addAll(collection); } return ret; } }