Skip to content

Instantly share code, notes, and snippets.

@kjunine
Created October 23, 2012 08:18
Show Gist options
  • Select an option

  • Save kjunine/3937602 to your computer and use it in GitHub Desktop.

Select an option

Save kjunine/3937602 to your computer and use it in GitHub Desktop.
sorted properties
import java.util.Collections;
import java.util.Enumeration;
import java.util.Properties;
import java.util.Vector;
@SuppressWarnings("serial")
public class SortedProperties extends Properties {
@SuppressWarnings({ "rawtypes", "unchecked" })
public synchronized Enumeration keys() {
Enumeration keys = super.keys();
Vector sorted = new Vector();
while (keys.hasMoreElements()) {
sorted.add(keys.nextElement());
}
Collections.sort(sorted);
return sorted.elements();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment