HashMap (Rust)
Në shqip përdoret i njëjti emër.
ShpjegimiSQ
HashMap ruan çifte çelës–vlerë. Me .entry(çelësi).or_insert(0) numëron diçka elegant — p.sh. sa herë shfaqet çdo fjalë.
EnglishEN
HashMap stores key–value pairs. With .entry(key).or_insert(0) you count things elegantly — e.g. how often each word appears.
Si ta mendosh
Si regjistri i notave: emri të çon te nota.
Lexoje në anglisht
Like a grade book: the name leads you to the grade.
Shembull kodirust
use std::collections::HashMap;
let mut numri = HashMap::new();
for fjala in "një dy një".split(' ') {
*numri.entry(fjala).or_insert(0) += 1;
}