From 3b4b0641d99ea57f68bfe3980d13bd437df38266 Mon Sep 17 00:00:00 2001 From: dreis2211 Date: Sun, 11 Nov 2018 11:59:01 +0100 Subject: [PATCH] Polish some Map operations Closes gh-15153 --- .../cloudfoundry/servlet/TokenValidator.java | 9 ++------- .../AutoConfigurationImportedCondition.java | 6 +++--- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/TokenValidator.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/TokenValidator.java index a4679641bf..4ce1d63ae3 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/TokenValidator.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/TokenValidator.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -84,12 +84,7 @@ class TokenValidator { } private boolean hasValidKeyId(String tokenKey) { - for (String candidate : this.tokenKeys.keySet()) { - if (tokenKey.equals(candidate)) { - return true; - } - } - return false; + return this.tokenKeys.containsKey(tokenKey); } private boolean hasValidSignature(Token token, String key) { diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/AutoConfigurationImportedCondition.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/AutoConfigurationImportedCondition.java index dc740d8f5d..38b3e210ea 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/AutoConfigurationImportedCondition.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/AutoConfigurationImportedCondition.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,8 +43,8 @@ public final class AutoConfigurationImportedCondition ConditionEvaluationReport report = ConditionEvaluationReport .get((ConfigurableListableBeanFactory) context .getAutowireCapableBeanFactory()); - return report.getConditionAndOutcomesBySource().keySet() - .contains(this.autoConfigurationClass.getName()); + return report.getConditionAndOutcomesBySource() + .containsKey(this.autoConfigurationClass.getName()); } /**