Java Properties create custom Properties to sort key
import java.io.FileOutputStream; import java.util.Collections; import java.util.Enumeration; import java.util.Properties; import java.util.Vector; public class Main{ public static void main(String[] args) throws Exception { SortedProperties sp = new SortedProperties(); sp.put("HTML", "tag"); sp.put("Java", "backend"); sp.put("CSS", "style"); sp.put("Javascript", "frontend"); FileOutputStream fos = new FileOutputStream("sp.props"); sp.store(fos, "sorted props"); }// www . j a v a 2 s. c o m } class SortedProperties extends Properties { public Enumeration keys() { Enumeration keysEnum = super.keys(); Vector<String> keyList = new Vector<String>(); while(keysEnum.hasMoreElements()){ keyList.add((String)keysEnum.nextElement()); } Collections.sort(keyList); return keyList.elements(); } }