Will it create any problem if we add elements with key as user defined object into the treemap?



Will it create any problem if we add elements with key as user defined object into the treemap?..

Answer / Makeshwar Tanti

No, it won't cause any problems. A TreeMap in Java can store keys of any type that implements the Comparable interface or provides a custom Comparator. This allows you to add user-defined objects as keys.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Data Structures Interview Questions

What can be stored in an arraylist?

1 Answers  


What is linked list with example?

1 Answers  


Which sorting algorithm is used in collections sort?

1 Answers  


Why concurrenthashmap is fail safe?

1 Answers  


What are the advantages of sorting and filtering data?

1 Answers  


What are different types of sorting algorithms?

1 Answers  


Explain the term recursive case?

1 Answers  


What do you mean by disjoint set adt?

1 Answers  


Explain implementation of deletion from a binary tree.

1 Answers  


Two linked lists are given, find out the sum of them without altering the linked list?

1 Answers   Expedia,


What data structure would you mostly likely see in a non recursive implementation of a recursive algorithm?

3 Answers   CTS,


What is the difference between static and dynamic data?

1 Answers  


Categories