Package ca.cgjennings.util
Class SortedProperties
- java.lang.Object
-
- java.util.Dictionary<K,V>
-
- java.util.Hashtable<java.lang.Object,java.lang.Object>
-
- java.util.Properties
-
- ca.cgjennings.util.SortedProperties
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.util.Map<java.lang.Object,java.lang.Object>
public class SortedProperties extends java.util.Properties
A subclass ofjava.util.Properties
that stores its entries in sorted order.- Since:
- 1.5
- Author:
- Chris Jennings
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SortedProperties()
Creates a new, empty sorted properties instance with no parent.SortedProperties(java.util.Properties defaults)
Creates a new, empty sorted properties instance with the specified parent.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Comparator<java.lang.Object>
getComparator()
Return a comparator that will be used to sort the keys.java.util.Enumeration<java.lang.Object>
keys()
Returns the keys of all properties stored in this instance, in sorted order.void
setComparator(java.util.Comparator<java.lang.Object> comparator)
Set the comparator that will be used to sort the keys.-
Methods inherited from class java.util.Properties
clear, clone, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, get, getOrDefault, getProperty, getProperty, hashCode, isEmpty, keySet, list, list, load, load, loadFromXML, merge, propertyNames, put, putAll, putIfAbsent, rehash, remove, remove, replace, replace, replaceAll, save, setProperty, size, store, store, storeToXML, storeToXML, storeToXML, stringPropertyNames, toString, values
-
-
-
-
Constructor Detail
-
SortedProperties
public SortedProperties()
Creates a new, empty sorted properties instance with no parent.
-
SortedProperties
public SortedProperties(java.util.Properties defaults)
Creates a new, empty sorted properties instance with the specified parent.- Parameters:
defaults
- the properties instance that determines the default values for this instance
-
-
Method Detail
-
keys
public java.util.Enumeration<java.lang.Object> keys()
Returns the keys of all properties stored in this instance, in sorted order.- Overrides:
keys
in classjava.util.Properties
- Returns:
- an enumeration of the property keys, in sorted order
-
getComparator
public java.util.Comparator<java.lang.Object> getComparator()
Return a comparator that will be used to sort the keys. Ifnull
is returned, keys will be sorted according to their natural order.- Returns:
- the comparator implementing the sort order, or
null
-
setComparator
public void setComparator(java.util.Comparator<java.lang.Object> comparator)
Set the comparator that will be used to sort the keys. Ifnull
, keys will be sorted according to their natural order.- Parameters:
comparator
- the comparator implementing the sort order, ornull
-
-