Merge pull request #15543 from igor-suhorukov
* pr/15543: Simplify code by using Map computeIfAbsent
This commit is contained in:
		
						commit
						6013146a9a
					
				| 
						 | 
				
			
			@ -104,11 +104,7 @@ class TypeElementMembers {
 | 
			
		|||
			else if (isSetter(method)) {
 | 
			
		||||
				String propertyName = getAccessorName(name);
 | 
			
		||||
				List<ExecutableElement> matchingSetters = this.publicSetters
 | 
			
		||||
						.get(propertyName);
 | 
			
		||||
				if (matchingSetters == null) {
 | 
			
		||||
					matchingSetters = new ArrayList<>();
 | 
			
		||||
					this.publicSetters.put(propertyName, matchingSetters);
 | 
			
		||||
				}
 | 
			
		||||
						.computeIfAbsent(propertyName, (k) -> new ArrayList<>());
 | 
			
		||||
				TypeMirror paramType = method.getParameters().get(0).asType();
 | 
			
		||||
				if (getMatchingSetter(matchingSetters, paramType) == null) {
 | 
			
		||||
					matchingSetters.add(method);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -136,11 +136,7 @@ public class ConfigurationMetadata {
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	private <K, V> void add(Map<K, List<V>> map, K key, V value) {
 | 
			
		||||
		List<V> values = map.get(key);
 | 
			
		||||
		if (values == null) {
 | 
			
		||||
			values = new ArrayList<>();
 | 
			
		||||
			map.put(key, values);
 | 
			
		||||
		}
 | 
			
		||||
		List<V> values = map.computeIfAbsent(key, (k) -> new ArrayList<>());
 | 
			
		||||
		values.add(value);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue