Here you can find the source of mergeCollectionsToList(Collection
public static <T> List<T> mergeCollectionsToList(Collection<T>... cols)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { public static <T> List<T> mergeCollectionsToList(Collection<T>... cols) { List<T> mergedList = new ArrayList<T>(countCollectionsSize(cols)); for (Collection<T> oneList : cols) { if (oneList == null) continue; mergedList.addAll(oneList);/*from w ww . j a v a 2 s . c o m*/ } return mergedList; } public static int countCollectionsSize(Collection... cols) { int totalSize = 0; if (cols == null || cols.length < 1) return totalSize; for (Collection oneList : cols) { if (oneList == null) continue; totalSize += oneList.size(); } return totalSize; } }