I have to write something like this:
Private set processed link = new hashset (); Public boolean processed (string url) throws malformedException {Returns processed link contains (new url); }This does not work, because the URL is another item in the archive URL. I need to compare the host and the URL of the generated URL in the hashetset. What is the best way?
I wanted to expand the URL with my class and override equals (), but the URL is final. So I have a second thought that something like URLHashSet has to do in the headset and override method. But I'm not sure that its performance will not be negatively impacted, because that hashetet will contain thousands of elements.
Do you have any idea how to solve it? Thank you.
I do not want it to feel harsh, but I think your understanding is equal to / Hashcode is flawed.
The URL should come out and compare equally, even if the object reference is two different objects.
I just make a simple test of creating two different URL objects with the same string URL value.
The following test should give you your answer:
u1 == u2 => False u1.equals (u2) = & gt; True u2.equals (u1) = & gt; True u1.hashCode () == u2.hashCode () => True
Unless my understanding of your problem is wrong.
Comments
Post a Comment