- Hands-On Data Structures and Algorithms with JavaScript
- Kashyap Mukkamala
- 175字
- 2021-06-30 19:12:16
Analyzing set and map types
Before actually using sets and maps, we will need to understand when and where we need to use them. Each data structure whether native or custom has its own strengths and weaknesses.
Not only is it important to utilize these strengths, it's much more important to avoid their weaknesses. To understand some of these, we will explore set and map types and why they are needed and where to employ them.
There are primarily four different set and map types:
- Map: A key-value pair in which the key can either be an Object or a primitive and can hold any arbitrary value.
- WeakMap: A key-value pair in which the key can only be an Object and can hold any arbitrary value. The Keys are weakly referenced; this means that they are not prevented from being garbage-collected if not in use.
- Set: Data type that allows a user to store unique values of any type.
- WeakSet: Similar to set, but maintains a weak reference.
推薦閱讀
- Mastering NetBeans
- Learning C# by Developing Games with Unity 2020
- Apache ZooKeeper Essentials
- 移動(dòng)UI設(shè)計(jì)(微課版)
- Visual Basic程序開發(fā)(學(xué)習(xí)筆記)
- PHP 7底層設(shè)計(jì)與源碼實(shí)現(xiàn)
- 微服務(wù)設(shè)計(jì)原理與架構(gòu)
- Django Design Patterns and Best Practices
- TypeScript圖形渲染實(shí)戰(zhàn):基于WebGL的3D架構(gòu)與實(shí)現(xiàn)
- Getting Started with LLVM Core Libraries
- PHP 7從零基礎(chǔ)到項(xiàng)目實(shí)戰(zhàn)
- Unity 2017 Game AI Programming(Third Edition)
- Selenium WebDriver Practical Guide
- Java RESTful Web Service實(shí)戰(zhàn)
- AI輔助編程Python實(shí)戰(zhàn):基于GitHub Copilot和ChatGPT