Remove superfluous AnnotationAttributes#putIfAbsent implementation
Since Java 8, putIfAbsent() is a standard method in java.util.Map. We therefore no longer need the custom implementation that overrides the standard implementation in HashMap.
This commit is contained in:
parent
a092dc055e
commit
30ebc3b8e2
|
@ -369,26 +369,6 @@ public class AnnotationAttributes extends LinkedHashMap<String, Object> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Store the supplied {@code value} in this map under the specified
|
|
||||||
* {@code key}, unless a value is already stored under the key.
|
|
||||||
* @param key the key under which to store the value
|
|
||||||
* @param value the value to store
|
|
||||||
* @return the current value stored in this map, or {@code null} if no
|
|
||||||
* value was previously stored in this map
|
|
||||||
* @see #get
|
|
||||||
* @see #put
|
|
||||||
* @since 4.2
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Object putIfAbsent(String key, Object value) {
|
|
||||||
Object obj = get(key);
|
|
||||||
if (obj == null) {
|
|
||||||
obj = put(key, value);
|
|
||||||
}
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
Iterator<Map.Entry<String, Object>> entries = entrySet().iterator();
|
Iterator<Map.Entry<String, Object>> entries = entrySet().iterator();
|
||||||
|
|
Loading…
Reference in New Issue