Search the courses, subjects, tracks, games and features, or jump straight to a page.
2 cards from this section. Quick, good the night before a test.
What is a TreeMap in Java?
Consider its name. What does 'tree' and 'map' imply?
Can TreeMap have null keys?
Think about how null might affect sorting.
What kind of data structure does TreeMap use?
Think about how TreeMap keeps its elements sorted.
True or False: TreeMaps allow null keys.
Recall the characteristics of TreeMap.
Create a TreeMap with several fruit names as keys and their corresponding prices as values. Write code to retrieve the price of a specific fruit and handle the case where the fruit does not exist.
Consider how you check if a key exists in a map.
Given a list of student scores, use a TreeMap to sort the scores and display them alongside their student names. Write appropriate code to achieve this.
Remember: the key is the score and the value is the student's name.
5 more questions in this section. Enroll free to practise them all.
Enroll free