Java List Union union(List... lists)

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

Description

Creates a union from all of the specified List s.

License

Open Source License

Parameter

Parameter Description
lists The List s.
T The type of List s.

Return

The union.

Declaration

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

Method Source Code

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

Related

  1. Union(List A, List B)
  2. union(List ls, List ls2)
  3. union(List byteList)
  4. union(List list1, List list2, boolean duplicate)
  5. union(List set1, List set2)
  6. unionAdd(List vect, E obj)
  7. unionCreditList(List list)
  8. unionList( Collection col1, Collection col2)
  9. unionList(List la, List lb)