Order guarantees

The ordering of list values is guaranteed because lists are an indexed collection. Maps are a keyed collection, which means that the order in which key-value pairs are added isn't guaranteed to be preserved. For example, let's say that I call myMap.set('one', 1).set('two', 2). If you were to iterate over this map, one would probably come before two. But this is misleading, because there are no ordering guarantees when it comes to iterating over maps. This could be a problem if your application expects iteration ordering to be consistent.

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

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