Storing a value inside a collection at a given key or index and then unconditionally overwriting it without reading the initial value is a case of
a "dead store".
This rule detects repeatedly adding an element at the same index or key in a collection or adding identical elements to a set.
fruits[1] = "banana";
fruits[1] = "apple"; // Noncompliant
myMap.set("key", 1);
myMap.set("key", 2); // Noncompliant
mySet.add(1);
mySet.add(1); // Noncompliant
This practice is redundant and will cause confusion for the reader. More importantly, it is often an error and not what the developer intended to
do.