Here you can find the source of union(List
Parameter | Description |
---|---|
lists | The List s. |
T | The type of List s. |
@SafeVarargs public static <T> List<T> union(List<T>... lists)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { /**/* www.ja va2 s . c o m*/ * Creates a union from all of the specified {@link List}s. * * @param lists The {@link List}s. * @param <T> The type of {@link List}s. * @return The union. */ @SafeVarargs public static <T> List<T> union(List<T>... lists) { List<T> newList = new LinkedList<>(); for (List<T> list : lists) { newList.addAll(list); } return newList; } }