Hashing

This Atom is Under Construction

Throughout this book you’ve been introduced to the most commonly-used collections, also called containers.

These include Lists (a specific version of the general concept of the sequence), and Maps (sometimes called associative arrays, because they associate keys with values). There’s a third collection which is used somewhat less often, the Set, which determines membership—is something in a Set or isn’t it? A Set also has the quality that it only allows one of each element, so it is often used to remove duplicates.

What we haven’t emphasized is that Lists, Maps and Sets are interfaces that have multiple implementations. The reason for these multiple implementations is that you use collections in different situations. Sometimes you’ll create a collection, and then only read from that collection and never add new elements. In other situations you’ll constantly be adding new elements. How you add those elements is also important. For example, with some implementations of List, adding elements at the end is very fast but putting them in the middle is much slower, while for other implementations it’s much less expensive to put elements in the middle.

End of sample. See AtomicKotlin.com for full early-access book.



Previous          Next

©2018 Mindview LLC. All Rights Reserved.