On Friday 04 April 2008 06:27, nextgens at freenetproject.org 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
> cvs at freenetproject.org
> http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs
> 
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 
<https://emu.freenetproject.org/pipermail/cvs/attachments/20080404/433dbeda/attachment.pgp>

Reply via email to