InternalAddOrReplace method

void InternalAddOrReplace(
  1. TEntry entry
)
Add or replace entry. The entry.

Implementation

void InternalAddOrReplace(TEntry entry) {
  if (this._entries.containsKey(entry.Key)) {
    TEntry oldEntry = this._entries[entry.Key]!;
    oldEntry.removeChangeEvent(this._EntryChanged);

    entry.addOnChangeEvent(this._EntryChanged);

    if (!this._addedEntries.contains(entry.Key)) {
      if (!this._modifiedEntries.contains(entry.Key)) {
        this._modifiedEntries.add(entry.Key);
      }
    }

    this.Changed();
  } else {
    this.InternalAdd(entry);
  }
}