Code example for TreeSet

0
public class SortedProperties extends Properties {
 
	public SortedProperties() { 
		super(); 
 
		_names = new TreeSet();
	} 
 
	public Enumeration propertyNames() {
		return Collections.enumeration(_names);
	} 
 
	public Object put(Object key, Object value) {
		if (_names.contains(key)) {
			_names.remove(key);
		} 
 
		_names.add(key);
 
		return super.put(key, value);
	}