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 different types of expressions?

0 Answers  


If you are given the name of the function at run time how will you invoke the function?

0 Answers   Adobe, Yahoo,


What is means by DLL file means ? What is the use of DLL file? What are the contents of DLL file?

4 Answers  


How do you invoke a method?

0 Answers  


When will you define a method as static?

0 Answers  






What are constants and how to create constants in java?

0 Answers  


explain about method overloading and method overriding with difficult examples

4 Answers  


Why Java is called as purely platform independent..? Explain briefly..dont Give regular answers Explain with your own example..?

8 Answers   Nokia,


JSP is by default thread safe or not? what is the meaning of isThreadSafe="true" and isThreadSafe="false". Explain it? Thanks, Seenu

9 Answers   Huawei,


Is there any way to skip finally block of exception even if some exception occurs in the exception block?

0 Answers  


Why does java have two ways to create child threads? Which way is better?

0 Answers  


I need some details about an employee. i have only the employee id in my presentation layer(JSP).I entered that ID and click "Show Details" Button. Question is how the JSP pass that id to Controller layer and DAO and what mechanism we are using to retrive data from DB and how the data passed to JSP as a Output. Please explain in detail.

1 Answers   TCS,


Categories