Here is a good explanation of the equals and hashcode methods for help on the tasks above:
https://codegym.cc/groups/posts/264-equals-and-hashcode-methods-best-practices
I passed easily every task just using the automatic "Generate hashCode() and equals()..." of the IDE. But I didn't really understand these codes, and so far Code Gym hasn't explained what we need to complete these tasks. Will these methods be better explained and exemplified in this course, or will I have to research them somewhere else?
The codes that passed the verification are much more sophisticated and complex than the ones of the examples in this lesson. Is it really expected from us, learners, to solve these tasks by our own, without copying/pasting? Or the purpose is indeed to make extra research, copy/paste, and then understand it only in the future?
I don't think they explain later in the course because, as they (CodeGym people) have mentioned multiple times during the course, we have to do research on our own.
Big hint for all three tasks: do not try to fix their code, remove their equals and hash methods and write them from scratch and you will pass the test. The only thing to watch out is to check explicitly if the object in comparison is an instance of Solution (as opposed to checking for generic getClass() != secondObject.getClass())
GO TO FULL VERSION