The source code never lies.
/**
* Gets all of the headers with the given name. The returned array
* maintains the relative order in which the headers were added.
*
* <p>Header name comparison is case insensitive.
*
* @param name the name of the header(s) to get
*
* @return an array of length ≥ 0
*/
@Override
public Header[] getHeaders(final String name) {
List<Header> headersFound = null;
for (int i = 0; i < this.headers.size(); i++) {
final Header header = this.headers.get(i);
if (header.getName().equalsIgnoreCase(name)) {
if (headersFound == null) {
headersFound = new ArrayList<>();
}
headersFound.add(header);
}
}
return headersFound != null ? headersFound.toArray(EMPTY) : EMPTY;
}