@Override public boolean equals (Object other) { if ( this == other ) { return true; } if ( !(other instanceof NameRolePair) ) { return false; } NameRolePair otherPair = (NameRolePair) other; return otherPair.hasName(name) && otherPair.hasRole(role); }