コード例 #1
0
 @Override
 public int hashCode() {
   final int prime = 31;
   int result = super.hashCode();
   result = prime * result + ((authorName == null) ? 0 : authorName.hashCode());
   result = prime * result + ((commentText == null) ? 0 : commentText.hashCode());
   result = prime * result + ((email == null) ? 0 : email.hashCode());
   result = prime * result + ((questionEntity == null) ? 0 : questionEntity.hashCode());
   result = prime * result + rate;
   result = prime * result + ((userpicUrl == null) ? 0 : userpicUrl.hashCode());
   return result;
 }
コード例 #2
0
 @Override
 public boolean equals(Object obj) {
   if (this == obj) {
     return true;
   }
   if (!super.equals(obj)) {
     return false;
   }
   if (getClass() != obj.getClass()) {
     return false;
   }
   CommentEntity other = (CommentEntity) obj;
   if (authorName == null) {
     if (other.authorName != null) {
       return false;
     }
   } else if (!authorName.equals(other.authorName)) {
     return false;
   }
   if (commentText == null) {
     if (other.commentText != null) {
       return false;
     }
   } else if (!commentText.equals(other.commentText)) {
     return false;
   }
   if (email == null) {
     if (other.email != null) {
       return false;
     }
   } else if (!email.equals(other.email)) {
     return false;
   }
   if (questionEntity == null) {
     if (other.questionEntity != null) {
       return false;
     }
   } else if (!questionEntity.equals(other.questionEntity)) {
     return false;
   }
   if (rate != other.rate) {
     return false;
   }
   if (userpicUrl == null) {
     if (other.userpicUrl != null) {
       return false;
     }
   } else if (!userpicUrl.equals(other.userpicUrl)) {
     return false;
   }
   return true;
 }