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-bcel.git
The following commit(s) were added to refs/heads/master by this push: new a936c27e Use Java 8 Map API new 65f10995 Merge branch 'master' of https://gitbox.apache.org/repos/asf/commons-bcel.git a936c27e is described below commit a936c27ee66baec989c669f3736027250986d81e Author: Gary David Gregory (Code signing key) <ggreg...@apache.org> AuthorDate: Sat Oct 29 06:50:13 2022 -0400 Use Java 8 Map API --- .../java/org/apache/bcel/verifier/Verifier.java | 30 ++++++++++------------ 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/main/java/org/apache/bcel/verifier/Verifier.java b/src/main/java/org/apache/bcel/verifier/Verifier.java index c8ab2746..75be8764 100644 --- a/src/main/java/org/apache/bcel/verifier/Verifier.java +++ b/src/main/java/org/apache/bcel/verifier/Verifier.java @@ -143,26 +143,24 @@ public class Verifier { return p2v.verify(); } - /** Returns the VerificationResult for the given pass. */ + /** + * Returns the VerificationResult for the given pass. + * + * @param methodNo The method to verify + * @return the VerificationResult + */ public VerificationResult doPass3a(final int methodNo) { - final String key = Integer.toString(methodNo); - Pass3aVerifier p3av = p3avs.get(key); - if (p3avs.get(key) == null) { - p3av = new Pass3aVerifier(this, methodNo); - p3avs.put(key, p3av); - } - return p3av.verify(); + return p3avs.computeIfAbsent(Integer.toString(methodNo), k -> new Pass3aVerifier(this, methodNo)).verify(); } - /** Returns the VerificationResult for the given pass. */ + /** + * Returns the VerificationResult for the given pass. + * + * @param methodNo The method to verify + * @return the VerificationResult + */ public VerificationResult doPass3b(final int methodNo) { - final String key = Integer.toString(methodNo); - Pass3bVerifier p3bv = p3bvs.get(key); - if (p3bvs.get(key) == null) { - p3bv = new Pass3bVerifier(this, methodNo); - p3bvs.put(key, p3bv); - } - return p3bv.verify(); + return p3bvs.computeIfAbsent(Integer.toString(methodNo), k -> new Pass3bVerifier(this, methodNo)).verify(); } /**