Mission Base

Program Base Library Functions

int pblSetRetainAll

( PblSet* set, void* collection )

Retains only the elements in this set that are contained in the specified collection.

Documentation

Retains only the elements in this set that are contained in the specified collection.

In other words, removes from this set all of its elements that are not contained in the specified collection.

This implementation iterates over this set, checking each element returned by the iterator in turn to see if it's contained in the specified collection.

If it's not so contained, it's removed from this set with the iterator's remove method in case of a tree set and with a direct removal method in case of an hash set. This hash set removal has a memory complexity of O(N), with N being the number of elements to be removed.

This method has a time complexity of O(N * M), with N being the size of the set and M being the size of the collection.

Parameters:
set - The set to use
collection - The elements to be retained in this set.
Returns:
int rc > 0: If this set changed as a result of the call.
int rc == 0: This set did not change.
int rc < 0: An error, see pbl_errno:
PBL_ERROR_PARAM_SET - The set cannot be iterated.
PBL_ERROR_CONCURRENT_MODIFICATION - The set was modified concurrently.
PBL_ERROR_PARAM_COLLECTION - The collection cannot be iterated.
PBL_ERROR_OUT_OF_MEMORY - Out of memory.

Alphabetic index



This page was generated with the help of DOC++.