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

What are the Object and Class that classes used for?

3 Answers   Mphasis,


What is a stream? what are the different types and classes of Streams?

2 Answers  


Why do we create public static method in java?

0 Answers  


What does .equals do in java?

0 Answers  


What is the most important feature of java? What is an interface?

0 Answers  


if u open login & logout ,how can udisplay the timelogin & logout members ?

0 Answers   Virtusa,


What is “try and catch” in java

2 Answers  


What is the difference between a factory and abstract factory pattern?

0 Answers  


Explain Method Overloading in Java.

1 Answers  


Why char array is preferred over string for storing password?

0 Answers  


How do you add an element to a set in java?

0 Answers  


printstream class method println() is calling using System class and its static object out .how it is explain any one in detail with example ?

1 Answers   TCS,


Categories