blob: afc3c59ff5d0c11bd294aec201c4673670de2b86 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.util;
import java.util.*;
/**
* This class is a sorted version of classical <tt>java.util.Properties</tt>.
* It is strongly inspired by http://forums.sun.com/thread.jspa?threadID=141144.
*
* @author Sebastien Vincent
*/
public class SortedProperties extends Properties
{
/**
* Serial version UID.
*/
private static final long serialVersionUID = 0L;
/**
* Get an enumeration of keys hold by the <tt>Properties</tt> object.
* Contrary to the original <tt>Properties</tt> implementation, it force
* the keys to be sorted alphabetically.
*/
public synchronized Enumeration<Object> keys()
{
final Object[] keys = keySet().toArray();
Arrays.sort(keys);
return new Enumeration<Object>()
{
int i = 0;
public boolean hasMoreElements()
{
return i < keys.length;
}
public Object nextElement()
{
return keys[i++];
}
};
}
}
|