Java List Concatenate concat(final Collection... lists)

Here you can find the source of concat(final Collection... lists)

Description

Concatenates a number of Collections into a single List

License

Open Source License

Parameter

Parameter Description
T a parameter
lists a parameter

Declaration

public static <T> List<T> concat(final Collection<? extends T>... lists) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;

import java.util.Collection;

import java.util.List;

public class Main {
    /**/*w  w  w.j av  a 2  s .co m*/
     * Concatenates a number of Collections into a single List
     *
     * @param <T>
     * @param lists
     *
     * @return
     */
    public static <T> List<T> concat(final Collection<? extends T>... lists) {
        ArrayList<T> al = new ArrayList<T>();

        for (Collection<? extends T> list : lists)
            if (list != null)
                al.addAll(list);

        return al;
    }
}

Related

  1. ByteConcatenator(List instructionbytes, int num)
  2. concat(Collection> lists)
  3. concat(Collection list1, Collection list2)
  4. concat(final byte[] result, final List buffers)
  5. concat(final List list1, final List list2)
  6. concat(List list)
  7. concat(List l1, List l2)
  8. concat(List list1, List list2)