aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/poi
diff options
context:
space:
mode:
authorMarius Volkhart <mariusvolkhart@apache.org>2021-03-10 21:42:19 +0000
committerMarius Volkhart <mariusvolkhart@apache.org>2021-03-10 21:42:19 +0000
commit6a967ae6228dbe7beaf56c727c08770bad2e669f (patch)
tree37fe8df678fa29521a43a5cd5cd8cca03f86fc03 /src/java/org/apache/poi
parent74b4a460b229882ff6d3bbace90e512b33fb3e1c (diff)
downloadpoi-6a967ae6228dbe7beaf56c727c08770bad2e669f.tar.gz
poi-6a967ae6228dbe7beaf56c727c08770bad2e669f.zip
Streamline HPSF CustomProperties collection retrieval
Reduce the number of map lookups necessary to compute the return values for methods that return collections of property details. Since we maintain parity between the `props` and `dictionary` contents, when retrieving property details, we can reference the `props` directly and avoid the `dictionary` indirection. git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1887453 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/poi')
-rw-r--r--src/java/org/apache/poi/hpsf/CustomProperties.java12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/java/org/apache/poi/hpsf/CustomProperties.java b/src/java/org/apache/poi/hpsf/CustomProperties.java
index e260e3066f..fa49246e80 100644
--- a/src/java/org/apache/poi/hpsf/CustomProperties.java
+++ b/src/java/org/apache/poi/hpsf/CustomProperties.java
@@ -219,9 +219,7 @@ public class CustomProperties implements Map<String,Object> {
*/
public List<CustomProperty> properties() {
List<CustomProperty> list = new ArrayList<>(props.size());
- for (Long l : dictionary.keySet()) {
- list.add(props.get(l));
- }
+ list.addAll(props.values());
return Collections.unmodifiableList(list);
}
@@ -231,8 +229,8 @@ public class CustomProperties implements Map<String,Object> {
@Override
public Collection<Object> values() {
List<Object> list = new ArrayList<>(props.size());
- for (Long l : dictionary.keySet()) {
- list.add(props.get(l).getValue());
+ for (CustomProperty property : props.values()) {
+ list.add(property.getValue());
}
return Collections.unmodifiableCollection(list);
}
@@ -240,8 +238,8 @@ public class CustomProperties implements Map<String,Object> {
@Override
public Set<Entry<String, Object>> entrySet() {
Map<String,Object> set = new LinkedHashMap<>(props.size());
- for (Entry<Long,String> se : dictionary.entrySet()) {
- set.put(se.getValue(), props.get(se.getKey()).getValue());
+ for (CustomProperty property : props.values()) {
+ set.put(property.getName(), property.getValue());
}
return Collections.unmodifiableSet(set.entrySet());
}