Progress.Collections.HashMap<K,V> class
- Last Updated: February 11, 2026
- 3 minute read
- OpenEdge
- Version 13.0
- Documentation
Represents a strongly-typed collection of key-value pairs (map) backed by a hash table. A map contains unique keys, where each key is associated with a value. The values are not required to be unique. The key-value pairs make up the elements in the map collection. The ordering of the elements in the map collection is not important.
The class is final and cannot be extended.
Serializable:
Yes
Constructor(s)
The following is the default constructor, which creates an instance of
HashMap with a default initial capacity (3) and a default
equality comparer.. The default equality comparer requires that the elements added
to the collection implement the Progress.Collections.IHashable interface. Note that that
requirement is enforced later while trying to add key-value pairs to the
HashMap collection.
|
The following constructor returns an instance of
HashMap with the specified
equality comparer. The comparer is used by the collection to get the hash code of
the key object and also to determine if the collection already contains the given
key. The constructor raises an error if the comparer object is not valid, or if the
object does not implement IEqualityComparer<K> (if invoked
dynamically), where K is the same type as in
HashMap<K,V>.
|
The following constructors are variations of those described above, where the
constructors take an additional parameter that defines the initial capacity of the
hash table for the collection. The capacity value must be greater than or equal to
zero (
0), otherwise the constructor raises an error.
|
Super Class
Interfaces
Public Properties
| Count property (Collections) | IsEmpty property (Collections) |
| Keys property | — |
Public Methods
Public Events
This class does not contain events.
Examples
The following example shows how to instantiate a
HashMap using the
default constructor and the default equality comparer.
|
The following example shows how to instantiate a
HashMap using a custom
equality comparer.
|
The following example shows how to create, manage, and iterate over a
HashMap. The example uses an Employee class
(shown) and assumes a class called Manager (not shown).| Employee.cls |
|---|
|
|
Notes
- The default initial capacity of the hash-table (number of buckets) is 3. If you
can estimate the size of the
HashMap, specifying the initial capacity eliminates the need to perform a number of resizing operations while adding elements to the collection. Note that theHashMapimplementation never shrinks the hash table, if pairs are removed or theHashMapis cleared. - The
HashMapimplementation supports any object-oriented ABL object as keys and values. This includes .NET objects, however you must specify your own equality comparer when adding .NET objects to theHashMap.
See also
<T> Generic type reference, Progress.Collections.IEqualityComparer<T> interface, Progress.Collections.IHashable interface