- 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.
推薦閱讀
- Getting Started with Gulp(Second Edition)
- Learning Chef
- Practical UX Design
- C# Programming Cookbook
- Learning ArcGIS Pro 2
- FFmpeg入門詳解:音視頻原理及應(yīng)用
- Serverless架構(gòu)
- 鴻蒙OS應(yīng)用編程實(shí)戰(zhàn)
- Advanced UFT 12 for Test Engineers Cookbook
- Managing Microsoft Hybrid Clouds
- C陷阱與缺陷
- Applied Deep Learning with Python
- Pandas 1.x Cookbook
- 大話代碼架構(gòu):項(xiàng)目實(shí)戰(zhàn)版
- 現(xiàn)代C++語言核心特性解析