Here you can find the source of union(final List
Parameter | Description |
---|---|
T | type. |
lists | the array of lists. |
@SafeVarargs public static final <T> List<T> union(final List<T>... lists)
//package com.java2s; import java.util.ArrayList; import java.util.List; public class Main { /**// ww w .j a v a2 s .co m * Unions the given array of lists into a single list. * * @param <T> type. * @param lists the array of lists. * @return a union of the given lists. */ @SafeVarargs public static final <T> List<T> union(final List<T>... lists) { final List<T> union = new ArrayList<>(); for (List<T> list : lists) { union.addAll(list); } return union; } }