Java List Concatenate concat(List l1, List l2)

Here you can find the source of concat(List l1, List l2)

Description

concat

License

Open Source License

Declaration

public static <T> List<T> concat(List<T> l1, List<T> l2) 

Method Source Code

//package com.java2s;

import java.util.ArrayList;

import java.util.List;

public class Main {
    public static <T> List<T> concat(List<T> l1, List<T> l2) {
        int size1 = l1.size();
        if (size1 == 0) {
            return l2;
        }//w ww .  j ava  2s.c om
        int size2 = l2.size();
        if (size2 == 0) {
            return l1;
        }
        List<T> l3 = new ArrayList<T>(size1 + size2);
        l3.addAll(l1);
        l3.addAll(l2);
        return l3;
    }
}

Related

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