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
|
@Override
|
||||||
public Set<Object> keySet() {
|
public Set<Object> keySet() {
|
||||||
|
if (size() <= 1)
|
||||||
|
return super.keySet();
|
||||||
return Collections.unmodifiableSortedSet(new TreeSet<Object>(super.keySet()));
|
return Collections.unmodifiableSortedSet(new TreeSet<Object>(super.keySet()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<Map.Entry<Object, Object>> entrySet() {
|
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());
|
TreeSet<Map.Entry<Object, Object>> rv = new TreeSet<Map.Entry<Object, Object>>(new EntryComparator());
|
||||||
rv.addAll(super.entrySet());
|
rv.addAll(super.entrySet());
|
||||||
return Collections.unmodifiableSortedSet(rv);
|
return Collections.unmodifiableSortedSet(rv);
|
||||||
|
Reference in New Issue
Block a user