Use a thread safe class for holding header values
@@ -3,7 +3,12 @@ package com.yahoo.jdisc;
import com.google.common.collect.ImmutableList;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentSkipListMap;
/**
* This is an encapsulation of the header fields that belong to either a {@link Request} or a {@link Response}. It is
@@ -14,13 +19,7 @@ import java.util.*;
*/
public class HeaderFields implements Map<String, List<String>> {
- private final TreeMap<String, List<String>> content = new TreeMap<>(new Comparator<String>() {
-
- @Override
- public int compare(String lhs, String rhs) {
- return lhs.compareToIgnoreCase(rhs);
- }
- });
+ private final ConcurrentSkipListMap<String, List<String>> content = new ConcurrentSkipListMap<>(String::compareToIgnoreCase);
@Override
public int size() {
