You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2021/12/02 16:13:38 UTC
[commons-compress] 03/04: Use Java 8 Map API.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git
commit ee8ef3345d5f62bee7c5fcb0651591fc7ecb9e75
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Dec 2 11:00:02 2021 -0500
Use Java 8 Map API.
---
.../compress/harmony/pack200/PackingOptions.java | 24 ++++------------------
1 file changed, 4 insertions(+), 20 deletions(-)
diff --git a/src/main/java/org/apache/commons/compress/harmony/pack200/PackingOptions.java b/src/main/java/org/apache/commons/compress/harmony/pack200/PackingOptions.java
index ccbc4ee..4c38702 100644
--- a/src/main/java/org/apache/commons/compress/harmony/pack200/PackingOptions.java
+++ b/src/main/java/org/apache/commons/compress/harmony/pack200/PackingOptions.java
@@ -294,44 +294,28 @@ public class PackingOptions {
if (classAttributeActions == null) {
return unknownAttributeAction;
}
- String action = classAttributeActions.get(type);
- if (action == null) {
- action = unknownAttributeAction;
- }
- return action;
+ return classAttributeActions.getOrDefault(type, unknownAttributeAction);
}
public String getUnknownMethodAttributeAction(final String type) {
if (methodAttributeActions == null) {
return unknownAttributeAction;
}
- String action = methodAttributeActions.get(type);
- if (action == null) {
- action = unknownAttributeAction;
- }
- return action;
+ return methodAttributeActions.getOrDefault(type, unknownAttributeAction);
}
public String getUnknownFieldAttributeAction(final String type) {
if (fieldAttributeActions == null) {
return unknownAttributeAction;
}
- String action = fieldAttributeActions.get(type);
- if (action == null) {
- action = unknownAttributeAction;
- }
- return action;
+ return fieldAttributeActions.getOrDefault(type, unknownAttributeAction);
}
public String getUnknownCodeAttributeAction(final String type) {
if (codeAttributeActions == null) {
return unknownAttributeAction;
}
- String action = codeAttributeActions.get(type);
- if (action == null) {
- action = unknownAttributeAction;
- }
- return action;
+ return codeAttributeActions.getOrDefault(type, unknownAttributeAction);
}
}