Ensuring tail recursiveness of hashCode/equals