AddAll( ) method (Collections)
- Last Updated: March 15, 2024
- 2 minute read
- OpenEdge
- Version 12.8
- Documentation
Adds all the elements from the given collection to the collection. Returns TRUE if elements were added successfully. Otherwise returns FALSE.
For a List<T>, the elements are added to the end of the
list.
For a SortedSet<T>, elements are
inserted into the sorted set according to the comparer implementation (default or
custom). AddAll() returns TRUE if at least one of
the elements was added to the set, or FALSE if the set already contains all the
elements from that collection, according to the comparer implementation.
Return type: LOGICAL
Access: PUBLIC
Applies to: Progress.Collections.List<T> class, Progress.Collections.SortedSet<T> class
Syntax
|
- otherCollection
- collection containing the element(s) to be added
Notes
- Any iterators on the collection become invalid once
Add(),AddAll(),Clear(),Insert(),Remove(),RemoveAt(), orSet()are called, and you must get a new iterator to iterate over the collection. - For a
SortedSet<T>,AddAll()raises an error if:- the comparer object specified via the specific constructor becomes invalid.
- the element is not a valid object reference (including the unknown value), if using the default comparer.
- the comparer raises an error.
- Once an element is added to a sorted set, you must call
Remove()(to remove the element from the set) before you explicitly delete the object instance while still in use in the set; otherwise errors occur. - When an object-oriented ABL object is added to a collection, the reference count of the object is incremented so that it is not garbage collected while it remains in the collection.
- For both
List<T>andSortedSet<T>,AddAll()raises an error if otherCollection represents the same collection instance.