An IMapper<K,V> implementation backed by an IMap<TKey,TValue>.
Remarks
A defaultValue can be set that is returned for keys that don't have an explicit value set.
It is legal to use null
as key, which can be assigned a value just like other keys.
Type Parameters
- K
- V
Type Details
- yFiles module
- core
Constructors
Creates an instance using a HashMap<K,V> as the backing store.
Remarks
null
item is stored separately.Parameters
A map of options to pass to the method.
- defaultValue - V
- The value to return if no specific value has been set for a given key.
Creates an instance using the provided HashMap<K,V> as the backing store.
Remarks
null
item is stored separately.Parameters
A map of options to pass to the method.
- dictionary - IMap<K|null,V|null>
- The IMap<TKey,TValue> to use as backing store.
- defaultValue - V
- The value to return if no specific value has been set for a given key.
Properties
Gets an enumerable over all entries in this (dictionary-based) mapper.
Methods
Calls clear on the backing implementation.
Gets the value for a given key in the mapping.
Remarks
Setting a value for an already existing key overwrites the previous value.
It depends on the specific implementation of the mapper whether a mapping can be removed. If an implementation provides a way to remove a mapping, that should be preferred over setting a null
value. For example, Mapper<K,V> provides the delete method.
Parameters
A map of options to pass to the method.
- key - K
- The key of the mapping.
Returns
- ↪V?
- The value.
See Also
Implements
Sets the value for a given key in the mapping.
Remarks
Setting a value for an already existing key overwrites the previous value.
It depends on the specific implementation of the mapper whether a mapping can be removed. If an implementation provides a way to remove a mapping, that should be preferred over setting a null
value. For example, Mapper<K,V> provides the delete method.
Parameters
A map of options to pass to the method.
- key - K
- The key of the mapping.
- value - V
- The value.