Java List Concatenate concat(List list, T... items)

Here you can find the source of concat(List list, T... items)

Description

concat

License

LGPL

Declaration

@SafeVarargs
    public static <T> List<T> concat(List<T> list, T... items) 

Method Source Code


//package com.java2s;
//License from project: LGPL 

import java.util.ArrayList;
import java.util.List;

public class Main {
    @SafeVarargs
    public static <T> List<T> concat(List<T> list, T... items) {
        List<T> ret = new ArrayList<>(list);
        for (T item : items) {
            ret.add(item);/*  www  .  j a  v a 2 s.c  om*/
        }
        return ret;
    }

    public static <T> List<T> concat(List<T> list, List<T> list2) {
        List<T> ret = new ArrayList<>(list);
        ret.addAll(list2);
        return ret;
    }
}

Related

  1. concat(List... lists)
  2. concat(List lista, String sep, StringBuilder destino)
  3. concat(List a, List b)
  4. concat(List collection1, List collection2)
  5. concat(List l1, List l2)
  6. concatAddresses(List addresses)
  7. concatAll(final T[] empty, Iterable arrayList)
  8. concatArrays(List arrays, int start, int size)
  9. concatArraysToList(final T[]... arrays)