Merge branch '6.0.x'

This commit is contained in:
Brian Clozel
2023-04-25 10:26:40 +02:00
9 changed files with 88 additions and 22 deletions

View File

@@ -27,6 +27,7 @@ import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.Spliterator;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
@@ -286,6 +287,11 @@ public class LinkedCaseInsensitiveMap<V> implements Map<String, V>, Serializable
return entrySet;
}
@Override
public void forEach(BiConsumer<? super String, ? super V> action) {
this.targetMap.forEach(action);
}
@Override
public LinkedCaseInsensitiveMap<V> clone() {
return new LinkedCaseInsensitiveMap<>(this);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2023 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.
@@ -22,6 +22,7 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.BiConsumer;
import org.springframework.lang.Nullable;
@@ -69,15 +70,13 @@ public class MultiValueMapAdapter<K, V> implements MultiValueMap<K, V>, Serializ
@Override
public void addAll(K key, List<? extends V> values) {
List<V> currentValues = this.targetMap.computeIfAbsent(key, k -> new ArrayList<>(1));
List<V> currentValues = this.targetMap.computeIfAbsent(key, k -> new ArrayList<>(values.size()));
currentValues.addAll(values);
}
@Override
public void addAll(MultiValueMap<K, V> values) {
for (Entry<K, List<V>> entry : values.entrySet()) {
addAll(entry.getKey(), entry.getValue());
}
values.forEach(this::addAll);
}
@Override
@@ -138,6 +137,12 @@ public class MultiValueMapAdapter<K, V> implements MultiValueMap<K, V>, Serializ
return this.targetMap.put(key, value);
}
@Override
@Nullable
public List<V> putIfAbsent(K key, List<V> value) {
return this.targetMap.putIfAbsent(key, value);
}
@Override
@Nullable
public List<V> remove(Object key) {
@@ -169,6 +174,11 @@ public class MultiValueMapAdapter<K, V> implements MultiValueMap<K, V>, Serializ
return this.targetMap.entrySet();
}
@Override
public void forEach(BiConsumer<? super K, ? super List<V>> action) {
this.targetMap.forEach(action);
}
@Override
public boolean equals(@Nullable Object other) {
return (this == other || this.targetMap.equals(other));