dcsimg
Union of many vectors with unicity garantee
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Monday, October 20, 2003 09:26 AM


In case of Vector is the method addAll garantee the unicity of the added elements in this collection?


If not can you help me with an efficient source code.


Thanks

Re: Union of many vectors with unicity garantee

Posted By:   Anonymous  
Posted On:   Monday, October 20, 2003 11:06 AM

addAll() will simply add all the elements without concern for unicity. For each element you want to add, you first need to check if the element is already present in the vector. This can be done with the contains() method (make sure the equals() is implemented for the type of the element you want to had, because contains() uses equals() to determine if the elements are equal).
About | Sitemap | Contact