forked from I2P_Developers/i2p.i2p
Util: Minor optimization in OrderedProperties
This commit is contained in:
@ -37,11 +37,15 @@ public class OrderedProperties extends Properties {
|
||||
|
||||
@Override
|
||||
public Set<Object> keySet() {
|
||||
if (size() <= 1)
|
||||
return super.keySet();
|
||||
return Collections.unmodifiableSortedSet(new TreeSet<Object>(super.keySet()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Map.Entry<Object, Object>> entrySet() {
|
||||
if (size() <= 1)
|
||||
return super.entrySet();
|
||||
TreeSet<Map.Entry<Object, Object>> rv = new TreeSet<Map.Entry<Object, Object>>(new EntryComparator());
|
||||
rv.addAll(super.entrySet());
|
||||
return Collections.unmodifiableSortedSet(rv);
|
||||
|
Reference in New Issue
Block a user