From c48883b9584a41db39154f3d6370d13b8c8f8018 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Fri, 3 Oct 2014 23:56:29 +0200 Subject: More FindBugs cleanup --- .../java/com/c2kernel/collection/Collection.java | 36 ++++++++++++++++++++-- 1 file changed, 33 insertions(+), 3 deletions(-) (limited to 'src/main/java/com/c2kernel/collection/Collection.java') diff --git a/src/main/java/com/c2kernel/collection/Collection.java b/src/main/java/com/c2kernel/collection/Collection.java index 7ab9fb2..2bedfb2 100644 --- a/src/main/java/com/c2kernel/collection/Collection.java +++ b/src/main/java/com/c2kernel/collection/Collection.java @@ -20,8 +20,6 @@ */ package com.c2kernel.collection; -import java.util.Iterator; - import com.c2kernel.common.InvalidCollectionModification; import com.c2kernel.common.ObjectAlreadyExistsException; import com.c2kernel.common.ObjectNotFoundException; @@ -173,6 +171,38 @@ abstract public class Collection implements C2KLocal public abstract void removeMember(int memberId) throws ObjectNotFoundException; @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + + ((mMembers == null) ? 0 : mMembers.hashCode()); + result = prime * result + ((mName == null) ? 0 : mName.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Collection other = (Collection) obj; + if (mMembers == null) { + if (other.mMembers != null) + return false; + } else if (!mMembers.equals(other.mMembers)) + return false; + if (mName == null) { + if (other.mName != null) + return false; + } else if (!mName.equals(other.mName)) + return false; + return true; + } + + /*@Override public boolean equals(Object other) { if (!(other instanceof Collection)) return false; Collection otherColl = (Collection)other; @@ -188,7 +218,7 @@ abstract public class Collection implements C2KLocal } } return true; - } + }*/ } -- cgit v1.2.3