@Test public void mediaTypesWithDifferentCharsetsHaveDifferentHashCode() { final ImmutableMediaType one=defaultMediaType().build(); final ImmutableMediaType other=defaultMediaType().withAlternativeCharset().build(); assertThat(one.hashCode(),not(equalTo(other.hashCode()))); }
@Override public int hashCode() { return mediaRangeHashCode() ^ standardParametersHashCode() ^ customParametersHashCode(); }
ImmutableMediaType implements MediaType { @Override public int hashCode() { return mediaRangeHashCode() ^ standardParametersHashCode() ^ customParametersHashCode(); } }
ImmutableMediaType implements MediaType { @Override public int hashCode() { return mediaRangeHashCode() ^ standardParametersHashCode() ^ customParametersHashCode(); } ImmutableMediaType(final MediaRangeSyntax syntax, final String type, final String subtype, String suffix, final Map<String, String> parameters); }
ImmutableMediaType implements MediaType { @Override public int hashCode() { return mediaRangeHashCode() ^ standardParametersHashCode() ^ customParametersHashCode(); } ImmutableMediaType(final MediaRangeSyntax syntax, final String type, final String subtype, String suffix, final Map<String, String> parameters); @Override String type(); @Override String subType(); @Override Charset charset(); @Override String suffix(); @Override Map<String,String> parameters(); @Override boolean isWildcard(); @Override String toHeader(); @Override int hashCode(); @Override boolean equals(final Object other); @Override String toString(); }
ImmutableMediaType implements MediaType { @Override public int hashCode() { return mediaRangeHashCode() ^ standardParametersHashCode() ^ customParametersHashCode(); } ImmutableMediaType(final MediaRangeSyntax syntax, final String type, final String subtype, String suffix, final Map<String, String> parameters); @Override String type(); @Override String subType(); @Override Charset charset(); @Override String suffix(); @Override Map<String,String> parameters(); @Override boolean isWildcard(); @Override String toHeader(); @Override int hashCode(); @Override boolean equals(final Object other); @Override String toString();  }