Java Collection : TreeMap - Exercises and Solution


1. Write a Java program to associate the specified value with the specified key in a Tree Map

View Solution

2. Write a Java program to copy a Tree Map content to another Tree Map content

View Solution

3. Write a Java program to search a key in a Tree Map

View Solution

4. Write a Java program to search a value in a Tree Map

View Solution

5. Write a Java program to get all keys from the given a Tree Map

View Solution

6. Write a Java program to delete all elements from a given Tree Map

View Solution

7. Write a Java program to sort keys in Tree Map by using comparator

View Solution

8. Write a Java program to get a key-value mapping associated with the greatest key and the least key in a map

View Solution

9. Write a Java program to get the first (lowest) key and the last (highest) key currently in a map

View Solution

10. Write a Java program to get a reverse order view of the keys contained in a given map

View Solution

11. Write a Java program to get a key-value mapping associated with the greatest key less than or equal to the given key

View Solution

12. Write a Java program to get the greatest key less than or equal to the given key

View Solution

13. Write a Java program to get the portion of a map whose keys are strictly less than a given key

View Solution

14. Write a Java program to get the portion of this map whose keys are less than (or equal to, if inclusive is true) a given key

View Solution

15. Write a Java program to get the least key strictly greater than the given key. Return null if there is no such key

View Solution

16. Write a Java program to get a portion of a map whose keys are greater than to a given key

View Solution

17. Write a Java program to get a portion of a map whose keys are greater than or equal to a given key

View Solution

18. Write a Java program to get the portion of a map whose keys range from a given key to another key

View Solution

19. Write a Java program to get the portion of a map whose keys range from a given key (inclusive), to another key (exclusive)

View Solution

20. Write a Java program to remove and get a key-value mapping associated with the greatest key in this map

View Solution



Basic Programs