Clan x86

Technical (Development, Security, etc.) => General Programming => Tutorials, References, and Examples => Topic started by: Camel on September 17, 2007, 02:27:00 pm

Title: [Java] SortedProperties
Post by: Camel on September 17, 2007, 02:27:00 pm
/**
 * This file is distributed under the GPL
 * $Id: SortedProperties.java 619 2007-08-28 14:57:28Z scotta $
 */

package net.bnubot.util;

import java.util.Collections;
import java.util.Enumeration;
import java.util.Properties;
import java.util.Vector;

public class SortedProperties extends Properties {
   private static final long serialVersionUID = 213081373529965920L;

   @SuppressWarnings("unchecked")
   public synchronized Enumeration keys() {
      Enumeration keysEnum = super.keys();
      Vector keyList = new Vector();
      while(keysEnum.hasMoreElements())
         keyList.add(keysEnum.nextElement());
      Collections.sort(keyList);
      return keyList.elements();
   }
}