Browse Source

Simplify GenericConversionService.getMatchableConverters()

Closes gh-24403
pull/24069/head
Hyunjin Choi 6 years ago committed by GitHub
parent
commit
550f13e8ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      spring-core/src/main/java/org/springframework/core/convert/support/GenericConversionService.java

9
spring-core/src/main/java/org/springframework/core/convert/support/GenericConversionService.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2020 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.
@ -519,12 +519,7 @@ public class GenericConversionService implements ConfigurableConversionService { @@ -519,12 +519,7 @@ public class GenericConversionService implements ConfigurableConversionService {
}
private ConvertersForPair getMatchableConverters(ConvertiblePair convertiblePair) {
ConvertersForPair convertersForPair = this.converters.get(convertiblePair);
if (convertersForPair == null) {
convertersForPair = new ConvertersForPair();
this.converters.put(convertiblePair, convertersForPair);
}
return convertersForPair;
return this.converters.computeIfAbsent(convertiblePair, k -> new ConvertersForPair());
}
public void remove(Class<?> sourceType, Class<?> targetType) {

Loading…
Cancel
Save