java.util Interface Collection public boolean addAll(Collection c) Adds all of the elements in the specified collection to this collection (optional operation). The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. (This implies that the behavior of this call is undefined if the specified collection is this collection, and this collection is nonempty.)Parameters:c - elements to be inserted into this collection.Returns:true if this collection changed as a result of the callThrows:UnsupportedOperationException - if this collection does not support the addAll method. ClassCastException - if the class of an element of the specified collection prevents it from being added to this collection. NullPointerException - if the specified collection contains one or more null elements and this collection does not support null elements, or if the specified collection is null.IllegalArgumentException - some aspect of an element of the specified collection prevents it from being added to this collection.参考这个方法试试看
可以保留前一个插入点的位置,从前一个插入点的位置往后搜索.
其他就是一些体力活了.:)
Interface Collection
public boolean addAll(Collection c)
Adds all of the elements in the specified collection to this collection (optional operation). The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. (This implies that the behavior of this call is undefined if the specified collection is this collection, and this collection is nonempty.)Parameters:c - elements to be inserted into this collection.Returns:true if this collection changed as a result of the callThrows:UnsupportedOperationException - if this collection does not support the addAll method.
ClassCastException - if the class of an element of the specified collection prevents it from being added to this collection.
NullPointerException - if the specified collection contains one or more null elements and this collection does not support null elements, or if the specified collection is null.IllegalArgumentException - some aspect of an element of the specified collection prevents it from being added to this collection.参考这个方法试试看