Lesson 32 of 34
HashMap: Key-Value சேமிப்புHashMap: Key-Value Storage
10 min 35 XP
HashMap ஒவ்வொரு key-க்கும் ஒரு value சேமிக்கும், அகராதி போல. Key மூலம் value-ஐ மிக வேகமாகப் பெறலாம். Key-கள் தனித்துவமானவை; அதே key-க்கு மீண்டும் put செய்தால் பழைய value மாறும்.
A HashMap stores a value for each key, like a dictionary, and finds a value by its key very fast. Keys are unique: putting the same key again replaces its value.
Example: edit me and press Run
Press Run to see the result here.சொற்களை எண்ணுவது HashMap-ன் மிகப் பிரபலமான பயன்பாடு: map.put(w, map.getOrDefault(w, 0) + 1). வரிசை முக்கியமெனில் TreeMap (sorted keys) பயன்படுத்துங்கள்.
Counting things is the classic HashMap use: map.put(w, map.getOrDefault(w, 0) + 1). If you need the keys in sorted order, use a TreeMap.
Example: edit me and press Run
Press Run to see the result here.