Why null is not allowed in treemap?



Why null is not allowed in treemap?..

Answer / Bharat Gautam

TreeMap does not allow null keys to prevent ambiguity when comparing the keys, as comparing two null keys would result in an undefined behavior. Similarly, it also does not allow null values for the same reason.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Data Structures Interview Questions

How many types of sorting algorithms are there?

1 Answers  


How to compare Two Arrays?

1 Answers  


Explain the common uses of tree database.

1 Answers  


Can arraylist hold different types?

1 Answers  


Can treemap key null?

1 Answers  


What is return map?

1 Answers  


What are the four characteristics of algorithms?

1 Answers  


Which is faster array or linked list?

1 Answers  


Run time memory allocation is known as ?

1 Answers  


What is hashing technique?

1 Answers  


Can we create a null as a key for a map collection?

1 Answers  


What is sorting with example?

1 Answers  


Categories