I have a sorting issue with a Hashmap. My constraint is that
I MUST use the Hashmap and work with existing code. I do a
database query and place the results in a Hashmap. When I
iterate thru the Hashmap, it loses the original alphabetical
sorting done by the database. So, my problem is that I must
sort the results coming out of the Hashmap which is then
placed into another class.
Answer / murali.25
1) Use a tree map or construct a treemap from hashmap.
2) If you have used order by in the query to DB, use LinkedHashMap
3) Have a java class with attributes corresponding to fields from the database table. Implement comparator interface.
|Is This Answer Correct ?||3 Yes||1 No|
Explain, why the constructor is required in implemented class?
What is hypertext?
My application URL : http://localhost:8080/Application/Login.jsp. When a user enter this url in IE then, how it get Login.JSP Page exactly? what are the processes will happen from when we submit the URL to get Login.jsp?
What is serialVersionUID and what is its need?
what r advatages of websphere? & how to deploy?
can you use the two main method in same class?how?
what is filters and its use?
Features of JAVA ? In which version of java synchronizedXXX() methods are included in Collections class.
What is the life cycle of Thread ?
when to use abstract class and when to use interface?
What is Co-Variant return type in method overriding?
I have 100 records in a table with two rows. I need to display 10 records per page like Google Search. I need only the Logic(Pagination) in Pure Java. No JSP and all..Thanks in Advance...