Can we add heterogeneous elements into treemap?



Can we add heterogeneous elements into treemap?..

Answer / Ram Babu

No, TreeMap can only store key-value pairs where the key must be of a type that implements Comparable or provides an explicit Comparator. The values can still be of any type.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Data Structures Interview Questions

What is a data structure? What are the types of data structures?

1 Answers  


Why do we use collections?

1 Answers  


Is map a collection?

1 Answers  


Explain about the types of linked lists

5 Answers  


Can we null keys in treemap?

1 Answers  


Is data structure a data type?

1 Answers  


What is list and types of list?

1 Answers  


There is a program which inserts and deletes node in a sorted singly linked list. There is a bug in one of the modules, how would you debug it?

1 Answers   DELL,


Define secondary clustering?

1 Answers  


Write a data structure for a queue.

1 Answers   Tavant Technologies, Zensar,


Define articulation point?

1 Answers  


What is the bucket size, when the overlapping and collision occur at the same time?

1 Answers  


Categories