集册 Java实例教程 将各种列表的元素合并到一个列表中。

将各种列表的元素合并到一个列表中。

欢马劈雪     最近更新时间:2020-01-02 10:19:05

398
将各种列表的元素合并到一个列表中。
/** 
 来自 时 代 J a v a 公 众 号 - nowjava.com**/


//package com.nowjava;

import java.util.ArrayList;


import java.util.List;


public class Main {

    /**

     * Combines the elements of various lists into one list.

     *

     * @param <T> Type of the elements in the list.

     * @param lists The lists to combine.

     *

     * @return The list created from the elements of all input lists.

     */

    public static <T> List<T> combine(final List<T>... lists) {

        final List<T> list = new ArrayList<T>();


        for (
展开阅读全文