How TreeMap sorts the objects inside it?? suppose if have
include one employee object and one car object. On what
basis it will sort?

Answers were Sorted based on User's Feedback



How TreeMap sorts the objects inside it?? suppose if have include one employee object and one car ..

Answer / anuj

then u have to tell the trremap that on what basis elment
shoyuld be sorted all elemtns of trremap should be of type
comparable & in side comparable compare to u need to put
uor sorting logic.

Is This Answer Correct ?    5 Yes 1 No

How TreeMap sorts the objects inside it?? suppose if have include one employee object and one car ..

Answer / shaik baji

The TreeMap sorts the objects in assending order by
depending on the key value.

The Key value must be "String" type so internally it will
sort the keys by using "compareTo" method.

Is This Answer Correct ?    4 Yes 0 No

How TreeMap sorts the objects inside it?? suppose if have include one employee object and one car ..

Answer / naveen.bav

Hello Venkatesh, I am not asking for synchronization. I am
asking how TreeMap will sort the values inside it.Thanks
for the reply

Is This Answer Correct ?    0 Yes 0 No

How TreeMap sorts the objects inside it?? suppose if have include one employee object and one car ..

Answer / malligontla

Tree Map working according to the Ascending order.

Is This Answer Correct ?    1 Yes 1 No

How TreeMap sorts the objects inside it?? suppose if have include one employee object and one car ..

Answer / venkatesh

call static method from Collections class
below is method:
static Map synchroizedMap(MaP Object)

Is This Answer Correct ?    2 Yes 9 No

Post New Answer

More Core Java Interview Questions

Differences between GridLayout and GridBagLayout?

1 Answers  


What are the differences between forwarding () method and sendredirect() methods?

0 Answers  


How is it possible for two string objects with identical values not to be equal under the == operator?

0 Answers  


extending thread class or implementing runnable interface. Which is better? : Java thread

0 Answers  


Where to store local variables?

0 Answers   Aspiring Minds,






What is a lock or purpose of locks in java?

0 Answers  


What environment variables are required to be set on a machine in order to run Java programs?

0 Answers   Tech Mahindra,


What are the restrictions that are applied to the java static methods?

0 Answers  


How do you invoke a method?

0 Answers  


Define an applet in java?

0 Answers  


What is static and final keyword in java?

0 Answers  


what is collections in java?

4 Answers  


Categories