overrideIfPresent method
V?
overrideIfPresent(
- K key,
- V ifPresent()
Replaces the value associated with a key if it exists
Example :
Channel channel = Channel.from({...});
guild.channels.cache.overrideIfPresent(channel.id, () => channel);
Implementation
V? overrideIfPresent (K key, V Function() ifPresent) {
if (this[key] != null) this[key] = ifPresent();
return this[key];
}