Question :How would you guarantee sorting of objects in a class that implements
Map interface? (JavaUtil)
Answer :TreeMap class implements SortedMap interface and provides the
guarantee of sorted objects in ascending key order.
TreeMap treeMap = new TreeMap();
treeMap.put("abc", "xyz");
treeMap.put("xyz", "abc");
treeMap.put("def","xyz");
System.out.println("treeMap::"+treeMap);
www.interviewhelper.org is a hope for all the Job seekers. Users can find unlimited here. These range from technical to HR, from functional to behavioral. www.interviewhelper.org contains in the fields like Ajax,VB,Networking,Sharepoint,JEE,Perl,Javascript,Bioinformatics,Classic ASP,Unix,Linux,Accounting,Oracle DBA,Microprocessor,Bluetooth,jms,jme,.net framework,ABAP,ASP,ASP.net,Basic .net Framework,Interview Questions,C language,C++,database,Oracle,Java,PHP,LAMP,SAP etc.
Friday, March 13, 2009
How would you guarantee sorting of objects in a class that implements
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment