An IMapper<K,V> implementation backed by a 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
- view-component
- yfiles-umd modules
- All view modules
- Legacy UMD name
- yfiles.collections.Mapper
See Also
Constructors
Creates an instance using a HashMap<K,V> as the backing store.
Remarks
Parameters
A map of options to pass to the method.
- defaultValue - V
The default value to return if no specific value has been set for a given key. This option sets the defaultValue property on the created object.
Creates an instance using the provided HashMap<K,V> as the backing store.
Remarks
Parameters
A map of options to pass to the method.
- dictionary - IMap<K,V>
- defaultValue - V
The default value to return if no specific value has been set for a given key. This option sets the defaultValue property on the created object.
Properties
Gets or sets the default value to return if no specific value has been set for a given key.
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, see the delete and delete methods of HashMap<K,V> and Mapper<K,V>, respectively.
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, see the delete and delete methods of HashMap<K,V> and Mapper<K,V>, respectively.
Parameters
A map of options to pass to the method.
- key - K
- The key of the mapping.
- value - V
- The value.