Allon Mureinik has posted comments on this change.

Change subject: engine: hashcode method simplification
......................................................................


Patch Set 1: Looks good to me, but someone else must approve

(3 inline comments)

Like the idea, some minor comments inline

....................................................
File 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/HashCodeBuilder.java
Line 1: package org.ovirt.engine.core.common.utils;
Line 2: 
Line 3: public class HashCodeBuilder {
Line 4:     public HashCodeBuilder(final int prime) {
Line 5:         super();
IMHO, the explicit Object constructor is redundant.
Line 6:         this.prime = prime;
Line 7:     }
Line 8: 
Line 9:     public HashCodeBuilder() {


Line 10:         this(31);
Line 11:     }
Line 12: 
Line 13:     final int prime;
Line 14:     int result = 1;
I'd make these two private
Line 15: 
Line 16:     public HashCodeBuilder append(Object obj) {
Line 17:         return append(ObjectUtils.hashCode(obj));
Line 18:     }


....................................................
File 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/ObjectUtils.java
Line 22:         return bd1 == bd2 || bd1 != null && bd2 != null && 
bd1.compareTo(bd2) == 0;
Line 23:     }
Line 24: 
Line 25:     public static int hashCode(Object obj) {
Line 26:         if(obj == null) {
in what case would you pass null?
Line 27:             return 0;
Line 28:         } else {
Line 29:             return obj.hashCode();
Line 30:         }


--
To view, visit http://gerrit.ovirt.org/14386
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I15afc6227f2a4d67befbdfe67b8c42b381308228
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Laszlo Hornyak <lhorn...@redhat.com>
Gerrit-Reviewer: Allon Mureinik <amure...@redhat.com>
Gerrit-Reviewer: Greg Padgett <gpadg...@redhat.com>
Gerrit-Reviewer: Laszlo Hornyak <lhorn...@redhat.com>
Gerrit-Reviewer: Yair Zaslavsky <yzasl...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to