Code example for ConcurrentHashMap

0
 
import java.util.Map; 
import java.util.concurrent.ConcurrentHashMap; 
 
public class AddCustomRequestHeaderCommand extends Command { 
  private static Map<String, String> headers = new ConcurrentHashMap<String, String>();
 
  private String key;
  private String value;
 
  public AddCustomRequestHeaderCommand(String key, String value) {
    this.key = key;
    this.value = value;
  } 
 
  @Override 
  public String execute() {
    headers.put(key, value);
 
    return "OK";