Map.keySet Method
Returns a set that contains the key values from a map.
Syntax
public Set keySet()
Run On
Called
Return Value
Type: Set Class
A set that contains the key values.
Examples
The following example deletes from a map all the elements that have key values that are not found as elements in a set.
public void deleteItems(Set _set, Map _map)
{
Set deletedSet;
SetEnumerator enumerator;
// deletedSet contains all key values from
// _map that are not values in _set
deletedSet = Set::difference(_map.keySet(), _set);
enumerator = deletedSet.getEnumerator();
while (enumerator.moveNext())
{
// Deletes elements from map with key
// values matching values in deletedSet
_map.remove(enumerator.current());
}
}