equals does not take MediaType parameters into account, while hashCode
uses the parameters to create a map.
1) I think equals should compare parameters. IMO text/plain;charset=ISO
!= text/plain;charset=UTF-8
2) hashCode should use the same elements to create the hash as equals
whether or not you agree with #1
If you agree with #1, the "q" parameter should be extracted from the
parameter map of MediaType when it is created. When a "q" parameter
exists it should be stored as a specific attribute within MediaType.
i.e. float MediaType.getAcceptQualifier(). Since q value is never
extracted, this makes it very difficult to use MediaTypes created from
an Accept header and use as keys to a Map.
Bill
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com