The current implementations of the overridden equals() methods assume that the argument is of the correct type. This assumption is quite dangerous because if the argument is not of the correct type, then casting to the expected type immediately throws a java.lang.ClassCastException.
https://github.com/williamfiset/Algorithms/blob/b25b0a33562100a23dab3027fac76cf529266ab2/src/main/java/com/williamfiset/algorithms/datastructures/hashtable/DoubleHashingTestObject.java#L89-L96
https://github.com/williamfiset/Algorithms/blob/b25b0a33562100a23dab3027fac76cf529266ab2/src/test/java/com/williamfiset/algorithms/datastructures/set/HSetTest.java#L27-L30
The current implementations of the overridden
equals()
methods assume that the argument is of the correct type. This assumption is quite dangerous because if the argument is not of the correct type, then casting to the expected type immediately throws ajava.lang.ClassCastException
.