Here you can find the source of merge(Collection
public static <T, C extends Collection<T>> List<T> merge(Collection<C> splits)
//package com.java2s; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; public class Main { public static <T, C extends Collection<T>> List<T> merge(Collection<C> splits) { if (splits == null || splits.isEmpty()) { return Collections.emptyList(); }// w w w . j av a 2 s.c o m List<T> list = new ArrayList<>(); for (Collection<T> split : splits) { list.addAll(split); } return list; } }