How can I get to sort
1 posts in topic
Flat View  Flat View

Posted By:   Phil_Kesel
Posted On:   Thursday, December 6, 2001 07:36 AM

I have a servlet-based web application that uses a static PropertiesManager class to maintain all Properties files used in the application. I have a servlet that displays and updates the Properties.

When I display the properties I can order by making a TreeMap from the Properties and writing the output from the map.

When I update a property and use the store method the output is all a disorganized mess because Properties is derived from Hashtable, which has no ordering. How can I get the method to write a sorted file?

Re: How can I get to sort

Posted By:   Anonymous  
Posted On:   Thursday, December 6, 2001 08:27 AM

Maybe is it not such a good idea to put your values into a Properties object to store your data. Your data in your treemap is already sorted, so when you put your information into a Hashtable, you unsort it, and then you want to ressort it, which is a lost of time. Anyway, I think what you are trying to do is possible only if you subclass Propreties and write your own store method, but you might as well subclass TreeMap and create a store method.
About | Sitemap | Contact