在java提供的数据容器中,恐怕没有比List的更常用的了。 除了一般的add,get之外lst还有一些很有用的特性
合并两个lst。 在编程中经常需要合并两个lst。 我曾经使用的愚蠢方法 lst1=new AarrayList(); for(int i=0;lst2.size();i++){ lst.add(lst2.get(i)); } 没想到竟然可以使用 addAll(Collection c)方法 这样要合并两个lst就可以这样 lst1.addAll(lst2); 默认将lst2中的所有对象加到lst1的尾部 addAll(int index, Collection c) 插入到指定位置。 
|