Fix issue with OrderedMap, OrderedSet and hashCode by jdeniau · Pull Request #2005 · immutable-js/immutable-js

when generating the hashCode of an element, we do use the size returned by __iterate. But in case of Ordered element, the internal representation of the underlying list might contain undefined elements :

Example:

const m = OrderedMap({a:'a', b:'b'}).remove('a')

m.size is 1, the __iterate function will iterate only one time on the b key, but the internal _list element, will have two elements: [undefined, ['b', 'b']]:

image
See https://runkit.com/jdeniau/immutable-hashcode-using-internal-list-size

I think that we should not use the value returned by __iterate, and use the object size directly.

Fixes #2002