Add and Remove
Create a HashMap with 3 animals and their sounds:
"cat"says"meow""dog"says"woof""cow"says"moo"
Then remove "dog" from the map. Print the remaining animals and their sounds in alphabetical order.
Expected output:
text
cat: meow cow: moo
Hints:
- Use
.insert()to add entries and.remove()to remove one - After removing, collect keys into a vector, sort, and loop to print
rust
fn main() {
}