I was going through the source of the Header class in okhttp3; For storing headers and the corresponding values, an ArrayList is used; So for first key 0, it's value will be at 1 and so on...
This is the method that does this work:
final List<String> namesAndValues = new ArrayList<>(20);
Builder addLenient(String name, String value) {
namesAndValues.add(name);
namesAndValues.add(value.trim());
return this;
}
So I just want to know the reason behind using an ArrayList instead of a Map like data structure