Skip to content

Commit

Permalink
enumConstant+= equals/hashCode
Browse files Browse the repository at this point in the history
  • Loading branch information
mbenson committed Aug 5, 2013
1 parent 816c028 commit 31d9cb3
Showing 1 changed file with 26 additions and 0 deletions.
Expand Up @@ -141,6 +141,32 @@ public Annotation<O> getAnnotation(final String type)
return annotations.getAnnotation(this, enumConstant, type);
}

public boolean equals(Object obj)
{
if (obj == this)
{
return true;
}
if (obj == null)
{
return false;
}
if (!obj.getClass().equals(getClass()))
{
return false;
}
final EnumConstantImpl<?> other = (EnumConstantImpl<?>) obj;
return other.enumConstant == enumConstant || other.enumConstant != null
&& other.enumConstant.equals(enumConstant);
}

@Override
public int hashCode()
{
int result = 57 << 4;
return result | (enumConstant == null ? 0 : enumConstant.hashCode());
}

@Override
public String toString()
{
Expand Down

0 comments on commit 31d9cb3

Please sign in to comment.