#Equals and hashCode problem

1 messages · Page 1 of 1 (latest)

magic nymphBOT
#

<@&987246399047479336> please have a look, thanks.

final cliff
#

dont ask to ask

#

just directly ask your question

#

otherwise we cant really help

#

uh no? stick to this channel please

main beacon
#

ok

radiant cloud
#

show full class please

final cliff
#

also what is the question?

#

is this
wut

graceful stag
main beacon
final cliff
#

depends

#

cant really tell without seeing the class

magic nymphBOT
#

I uploaded your attachments as Gist.

radiant cloud
#

@main beacon I don't understand what this class is about
The names sound like chess but the way the class is done, it doesn't sound like a chess engine Thinkfused

#

Sound correct
By the way, don't forget to put final on everything that cannot change
And don't use clonable

main beacon
fathom carbon
#

Same with toString

#

don’t waste your time implementing them yourself

#

the compiler can always do it better

graceful stag
#

It depends on the situation

vague schooner
fathom carbon
#

sure but I’ve never run into a case where I could make a better equals and hashcode function than intelliJ

vague schooner
quaint sage
#

The IDE couldn't implement the hashcode and equals for a new List implementation.

#

It can implement most cases where there is no family-of-types relationship, and where there is no internal caching or other stateful-ness that does not reflect external state.