Java List Union union(final List... lists)

Here you can find the source of union(final List... lists)

Description

Unions the given array of lists into a single list.

License

Open Source License

Parameter

Parameter Description
T type.
lists the array of lists.

Return

a union of the given lists.

Declaration

@SafeVarargs
public static final <T> List<T> union(final List<T>... lists) 

Method Source Code

//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;
    }
}

Related

  1. union(final char[]... list)
  2. union(final List list1, final List list2)
  3. union(final List list1, final List list2)
  4. union(final List list1, final List list2)
  5. union(final List list1, final List list2)
  6. Union(List A, List B)
  7. union(List ls, List ls2)
  8. union(List byteList)
  9. union(List list1, List list2, boolean duplicate)