Adds a key-value pair to the collection. The method returns TRUE if the key is added to the map, otherwise it returns FALSE, which means that the key is already in the map according to the equality comparer implementation. The added key must implement Progress.Collections.IHashable, if using the default comparer implementation. The comparer implementation decides if a key object is the same as another one in the collection.

Return type: LOGICAL

Access: PUBLIC

Applies to: Progress.Collections.HashMap<K,V> class

Syntax

Add(key AS K, value AS V)

Add(pair AS Progress.Collections.KeyValuePair<K,V>)
key
The key object to be added to the collection.
value
The object to be associated with key.
pair
The key-value pair object to be added to the collection.
The method raises an error if:
  • The key object does not implement Progress.Collections.IHashable, if using the default equality comparer implementation.
  • The key object is not a valid object reference (including the Unknown value (?)), if using the default equality comparer.
  • The equality comparer object specified via the specific constructor has become invalid.
  • The custom equality comparer raises an error.

See also

<T> Generic type reference