Lesson 32 of 34
HashMap: Key-Value भंडारण
10 min 35 XP
HashMap हर key के लिए एक value रखता है, शब्दकोश की तरह, और key से value बहुत तेज़ी से ढूँढता है। Keys अद्वितीय होती हैं: वही key दोबारा put करने पर उसकी value बदल जाती है।
Example: edit me and press Run
Output Loading Java (first time takes a few seconds)
Press Run to see the result here.चीज़ें गिनना HashMap का क्लासिक उपयोग है: map.put(w, map.getOrDefault(w, 0) + 1)। Keys sorted क्रम में चाहिए तो TreeMap लें।
Example: edit me and press Run
Output Loading Java (first time takes a few seconds)
Press Run to see the result here.