Maps with keys only

Under the hood, sets are maps with no values. When a value is added to a set, it's added to an internal map as a key. It also adds a value because it has to do so, but it isn't used for anything. This is done so that Immutable.js can reuse the map implementation for the purpose of removing duplicate values using deep equality. For example, if you were to add a key to a map and this key was already set, it isn't going to add another version of the same key. It will just update the value.

This internal detail explains why the get() method doesn't work the way you might think that it should, and why set iteration behaves the same way as map iteration.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.225.31.77