Coverage Summary for Class: ForwardingConcurrentMap (com.google.common.collect)

Class Class, % Method, % Line, %
ForwardingConcurrentMap 0% (0/1) 0% (0/5) 0% (0/5)


1 /* 2  * Copyright (C) 2007 The Guava Authors 3  * 4  * Licensed under the Apache License, Version 2.0 (the "License"); 5  * you may not use this file except in compliance with the License. 6  * You may obtain a copy of the License at 7  * 8  * http://www.apache.org/licenses/LICENSE-2.0 9  * 10  * Unless required by applicable law or agreed to in writing, software 11  * distributed under the License is distributed on an "AS IS" BASIS, 12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13  * See the License for the specific language governing permissions and 14  * limitations under the License. 15  */ 16  17 package com.google.common.collect; 18  19 import com.google.common.annotations.GwtCompatible; 20 import com.google.errorprone.annotations.CanIgnoreReturnValue; 21 import java.util.concurrent.ConcurrentMap; 22  23 /** 24  * A concurrent map which forwards all its method calls to another concurrent map. Subclasses should 25  * override one or more methods to modify the behavior of the backing map as desired per the <a 26  * href="http://en.wikipedia.org/wiki/Decorator_pattern">decorator pattern</a>. 27  * 28  * <p><b>{@code default} method warning:</b> This class forwards calls to <i>only some</i> {@code 29  * default} methods. Specifically, it forwards calls only for methods that existed <a 30  * href="https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ConcurrentMap.html">before 31  * {@code default} methods were introduced</a>. For newer methods, like {@code forEach}, it inherits 32  * their default implementations. When those implementations invoke methods, they invoke methods on 33  * the {@code ForwardingConcurrentMap}. 34  * 35  * @author Charles Fry 36  * @since 2.0 37  */ 38 @GwtCompatible 39 public abstract class ForwardingConcurrentMap<K, V> extends ForwardingMap<K, V> 40  implements ConcurrentMap<K, V> { 41  42  /** Constructor for use by subclasses. */ 43  protected ForwardingConcurrentMap() {} 44  45  @Override 46  protected abstract ConcurrentMap<K, V> delegate(); 47  48  @CanIgnoreReturnValue 49  @Override 50  public V putIfAbsent(K key, V value) { 51  return delegate().putIfAbsent(key, value); 52  } 53  54  @CanIgnoreReturnValue 55  @Override 56  public boolean remove(Object key, Object value) { 57  return delegate().remove(key, value); 58  } 59  60  @CanIgnoreReturnValue 61  @Override 62  public V replace(K key, V value) { 63  return delegate().replace(key, value); 64  } 65  66  @CanIgnoreReturnValue 67  @Override 68  public boolean replace(K key, V oldValue, V newValue) { 69  return delegate().replace(key, oldValue, newValue); 70  } 71 }