Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Java Maps!
You have completed Java Maps!
Preview
In this video we'll go over the basic functions of the Map interface and walk through using them!
Print Statement
System.out.println(lunch + " " + hasLunch + " " + hasGyros + " " + size);
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
To retrieve an item from a map,
you just call the get function and
0:00
pass in the key of the item
you're looking for.
0:03
So to print out only what's for dinner,
we just need to change this meals
0:06
to meals.get, and pass in dinner.
0:10
Then, if we run the app We'll see that
tonight we're getting enchiladas.
0:15
In addition to put and
0:23
get, there's four other functions of
maps that you should probably know.
0:24
The first of these is the remove function.
0:29
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up