Simplify GenericConversionService.getMatchableConverters()

Closes gh-24403
This commit is contained in:
Hyunjin Choi 2020-02-04 20:59:57 +09:00 committed by GitHub
parent a36168c972
commit 550f13e8ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 7 deletions

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -519,12 +519,7 @@ public class GenericConversionService implements ConfigurableConversionService {
} }
private ConvertersForPair getMatchableConverters(ConvertiblePair convertiblePair) { private ConvertersForPair getMatchableConverters(ConvertiblePair convertiblePair) {
ConvertersForPair convertersForPair = this.converters.get(convertiblePair); return this.converters.computeIfAbsent(convertiblePair, k -> new ConvertersForPair());
if (convertersForPair == null) {
convertersForPair = new ConvertersForPair();
this.converters.put(convertiblePair, convertersForPair);
}
return convertersForPair;
} }
public void remove(Class<?> sourceType, Class<?> targetType) { public void remove(Class<?> sourceType, Class<?> targetType) {