Here you can find the source of combine(Collection>... collections)
@SuppressWarnings("unchecked") public static <T> List<T> combine(Collection<?>... collections)
//package com.java2s; /******************************************************************************* * Copyright (c) 2010-2015 BSI Business Systems Integration AG. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors://from w w w . ja v a 2s . co m * BSI Business Systems Integration AG - initial API and implementation ******************************************************************************/ import java.util.ArrayList; import java.util.Collection; import java.util.List; public class Main { /** * combine all lists into one list containing all elements. the order of the items is preserved */ @SuppressWarnings("unchecked") public static <T> List<T> combine(Collection<?>... collections) { List<T> list = new ArrayList<T>(); if (collections != null && collections.length > 0) { for (Collection<?> c : collections) { for (Object t : c) { list.add((T) t); } } } return list; } }