In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces the relevant knowledge of "can map define length in go language". The editor shows you the operation process through an actual case. The operation method is simple, fast and practical. I hope this article "can map define length in go language" can help you solve the problem.
Map in the go language can define length. Map can scale dynamically according to the new key-value, so there is no fixed length or maximum limit, but you can also choose to mark the initial capacity of map cap, the syntax "make (map [keytype] valuetype, cap)".
The operating environment of this tutorial: windows10 system, GO 1.11.2, Dell G3 computer.
Map in Go language is a special data structure, an unordered set of element pairs (pair). Pair corresponds to an key (index) and a value (value), so this structure is also called associative array or dictionary. It is an ideal structure that can quickly find values. Given key, you can quickly find the corresponding value.
The data structure of map is also known as Python, hash, HashTable, and so on in other programming languages.
Map capacity
Unlike arrays, map can dynamically scale according to the newly added key-value, so it does not have a fixed length or maximum limit, but you can also choose to mark the initial capacity capacity of map in the following format:
Make (map [keytype] valuetype, cap)
For example:
Map2: = make (map [string] float, 100)
When the map grows to the capacity limit, the size of the new key-value,map will be automatically increased by 1, so for performance reasons, for large map or map that will expand rapidly, it is best to mark it first, even if you only know the capacity.
Here is a concrete example of map, which maps the scale to the corresponding audio:
NoteFrequency: = map [string] float32 {"C0": 16.35," D0 ": 18.35," E0": 20.60," F0 ": 21.83," G0": 24.50," A0 ": 27.50," B0": 30.87,440} about "can map define length in go language". Thank you for your reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.