How to sort properties in Java
Sometimes you have to deal with Properties files in Java. And sometimes you have to sort the entries based on the keys stored on the file, and you realized that is not so easy using default Properties class from java.util package.
This occurs because java.util.Properties extends java.util.Hashtable, which does not define a predictable sort order for keys or values.
For this situation, you can use the SortedProperties class to get entries sorted by key alphabetically.