Headers implements Streamable<Header> { public Headers add(Header header) { return add(Collections.singletonList(header)); } Headers();  Headers(final Headers headers);  Headers(final Iterable<Header> headers);  Headers(final Map<String, List<String>> headers); private  Headers(final HeaderHashMap headers); List<Header> getHeaders(String name); List<Directives> getDirectives(String name); Optional<Header> getFirstHeader(String headerKey); Optional<String> getFirstHeaderValue(String headerKey); Optional<Directives> getFirstHeaderValueAsDirectives(String headerKey); Headers add(Header header); Headers add(String key, String value); Headers add(Iterable<Header> headers); Headers add(String name, Iterable<String> values); Headers set(Header header); Headers set(String name, String value); Headers set(Iterable<Header> headers); boolean contains(Header header); boolean contains(String headerName); @Deprecated boolean hasHeader(String headerName); Headers remove(String name); Iterator<Header> iterator(); Set<String> keySet(); int size(); boolean isEmpty(); Headers asCacheable(); boolean isCachable(); List<Preference> getAcceptLanguage(); Headers withAcceptLanguage(List<Preference> acceptLanguage); List<Preference> getAcceptCharset(); Headers withAcceptCharset(List<Preference> charsets); List<Preference> getAccept(); Headers withAccept(List<Preference> charsets); Headers addAccept(Preference... accept); Headers addAccept(MIMEType... accept); Headers addAcceptLanguage(Locale... accept); Headers addAcceptLanguage(Preference... accept); Headers addAcceptCharset(Preference... accept); Set<HTTPMethod> getAllow(); Headers withAllow(Set<HTTPMethod> allow); Optional<CacheControl> getCacheControl(); Headers withCacheControl(CacheControl cc); Optional<LocalDateTime> getDate(); Headers withDate(LocalDateTime dt); Optional<MIMEType> getContentType(); Headers withContentType(MIMEType ct); Optional<LocalDateTime> getExpires(); Headers withExpires(LocalDateTime expires); Optional<LocalDateTime> getLastModified(); Headers withLastModified(LocalDateTime lm); Conditionals getConditionals(); Headers withConditionals(Conditionals conditionals); Optional<Tag> getETag(); Headers withETag(Tag tag); Optional<URI> getLocation(); Headers withLocation(URI href); Optional<Long> getContentLength(); Headers withContentLength(long length); Optional<URI> getContentLocation(); Headers withContentLocation(URI href); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static Headers parse(String input);  }
@Test public void testHeadersEquals() { Headers h = new Headers().add(HeaderConstants.ACCEPT, "application/xhtml").add("Foo", "Bar").add(HeaderConstants.AGE, "23"); Headers h2 = new Headers().add(HeaderConstants.ACCEPT, "application/xhtml").add("Foo", "Bar").add(HeaderConstants.AGE, "23"); assertEquals(h, h2); }
@Test public void testHeadersEquals2() { Headers h = new Headers().add("Foo", "Bar").add(HeaderConstants.AGE, "23").add(HeaderConstants.ACCEPT, "application/xhtml"); Headers h2 = new Headers().add(HeaderConstants.ACCEPT, "application/xhtml").add("Foo", "Bar").add(HeaderConstants.AGE, "23"); assertEquals(h, h2); }