On Friday 04 April 2008 06:27, [EMAIL PROTECTED] wrote: > Author: nextgens > Date: 2008-04-04 05:27:02 +0000 (Fri, 04 Apr 2008) > New Revision: 18969 > > Modified: > trunk/freenet/src/freenet/clients/http/bookmark/BookmarkItem.java > Log: > implement BookmarkItem.hashCode()
Again, two points:
- This will change, and therefore break containing HashSet's etc, if the parts
cease to be null. Are they all essential? If they are, are they final, and
can they be null?
- Justification for the maths?
>
> Modified: trunk/freenet/src/freenet/clients/http/bookmark/BookmarkItem.java
> ===================================================================
> --- trunk/freenet/src/freenet/clients/http/bookmark/BookmarkItem.java
2008-04-04 05:25:41 UTC (rev 18968)
> +++ trunk/freenet/src/freenet/clients/http/bookmark/BookmarkItem.java
2008-04-04 05:27:02 UTC (rev 18969)
> @@ -166,6 +166,15 @@
> return USK.create(key);
> }
>
> + public int hashCode() {
> + int hash = 7;
> + hash = 31 * hash + (this.key != null ? this.key.hashCode() : 0);
> + hash = 31 * hash + (this.hasAnActivelink ? 1 : 0);
> + hash = 31 * hash + (this.alerts != null ?
> this.alerts.hashCode() : 0);
> + hash = 31 * hash + (this.desc != null ? this.desc.hashCode() :
> 0);
> + return hash;
> + }
> +
> public boolean equals(Object o) {
> if (o == this) {
> return true;
>
> _______________________________________________
> cvs mailing list
> [email protected]
> http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs
>
>
pgpd3WdTjsMoG.pgp
Description: PGP signature
_______________________________________________ cvs mailing list [email protected] http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs
