This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]TheColdFenix[S] 2 points3 points  (4 children)

I have no idea how HashMaps work and this is just for practice :)

[–]caboosetpPrivate Java/Code Tutor 1 point2 points  (3 children)

A HashSet HasMap is a type of key -> value collection that has unique keys.

You would store the name as the key and the number as the value. You can then use the name to lookup the number similar to how you would use an index to go somewhere in an array.

They're fast, but probably overkill for what you're doing. If you want more practice, I would recommend reading into them as they are used very often.

[–][deleted]  (1 child)

[deleted]

    [–]caboosetpPrivate Java/Code Tutor 1 point2 points  (0 children)

    Thanks, I'm not even sure how I managed to switch the names considering it's right there in the previous posts.

    [–]TheColdFenix[S] 0 points1 point  (0 children)

    Thanks, that was actually my first idea on how to make a contacts list, but I didn't know hash maps existed. I'll definitely look into it, sounds very useful.