Re: Add equals() and hashCode() to org.apache.http.NameValuePair?
Am 2018-04-06 um 18:19 schrieb Oleg Kalnichevski: On Fri, 2018-04-06 at 10:02 -0600, Gary Gregory wrote: Hi All: I have cases where I want to use a Set of org.apache.http.NameValuePair instead of a list of NameValuePair (to track what headers I need to remove for example.). But, since NameValuePair does not specify equals() and hashCode() it feels like I am using an undocumented feature of the implementation of Basic NameValuePair. Adding these two method would tell call sites: Yes, you can use NameValuePair in a Set, Map, and so on. This assumes that all implementation already support the two methods... so if a 3rd party does not, the changes are misleading. Thought? Gary I am not sure I understand. NameValuePair is an interface, is it not? It cannot implement #equals and #hashCode. Besides we are back to the same fundamental question: what constitutes equality of two HTTP headers if we are to mandate Header to implement #equals and #hashCode. Correct! - To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org
Re: Add equals() and hashCode() to org.apache.http.NameValuePair?
Am 2018-04-06 um 18:02 schrieb Gary Gregory: Hi All: I have cases where I want to use a Set of org.apache.http.NameValuePair instead of a list of NameValuePair (to track what headers I need to remove for example.). But, since NameValuePair does not specify equals() and hashCode() it feels like I am using an undocumented feature of the implementation of Basic NameValuePair. Adding these two method would tell call sites: Yes, you can use NameValuePair in a Set, Map, and so on. This assumes that all implementation already support the two methods... so if a 3rd party does not, the changes are misleading. Thought? This will cause problems. Since Header interface derives from it, you will have to implement both for it. I do remember an issue where exactly this was requested for comparing them, but Oleg rejected to implement it because it is impossible to compare w/o knowing the semantic meaning. So this has to stay an implementation detail and cannot be enforced. Michael - To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org
Re: Add equals() and hashCode() to org.apache.http.NameValuePair?
On Fri, 2018-04-06 at 10:02 -0600, Gary Gregory wrote: > Hi All: > > I have cases where I want to use a Set of > org.apache.http.NameValuePair > instead of a list of NameValuePair (to track what headers I need to > remove > for example.). > > But, since NameValuePair does not specify equals() and hashCode() it > feels > like I am using an undocumented feature of the implementation of > Basic > NameValuePair. > > Adding these two method would tell call sites: Yes, you can use > NameValuePair > in a Set, Map, and so on. This assumes that all implementation > already > support the two methods... so if a 3rd party does not, the changes > are > misleading. > > Thought? > > Gary I am not sure I understand. NameValuePair is an interface, is it not? It cannot implement #equals and #hashCode. Besides we are back to the same fundamental question: what constitutes equality of two HTTP headers if we are to mandate Header to implement #equals and #hashCode. Oleg - To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org
Add equals() and hashCode() to org.apache.http.NameValuePair?
Hi All: I have cases where I want to use a Set of org.apache.http.NameValuePair instead of a list of NameValuePair (to track what headers I need to remove for example.). But, since NameValuePair does not specify equals() and hashCode() it feels like I am using an undocumented feature of the implementation of Basic NameValuePair. Adding these two method would tell call sites: Yes, you can use NameValuePair in a Set, Map, and so on. This assumes that all implementation already support the two methods... so if a 3rd party does not, the changes are misleading. Thought? Gary