Java加入两个给定的列表


Java加入两个给定的列表

import java.util.ArrayList;

import java.util.List;



public class JoinList {

   public static void main(String[] args) {

      List l1 = new ArrayList();

      l1.add("Java");

      List l2 = new ArrayList();



      l2.add("J2EE");

      List join = new ArrayList();

      join.addAll(l1);

      join.addAll(l2);



      System.out.println("list1: " + l1);

      System.out.println("list2: " + l2);

      System.out.println("joined: " + join);

   }

}