TIL ArrayDeque hashCode and equals
· One min read
TIL that LinkedList
overrides equals and hashCode, but ArrayDeque doesn't!
This means that regardless of the contents of ArrayDeque
, it gives the same hashCode
value.
This bit me when using Deque<T> dq = new ArrayDeque<>();
See Stack Overflow: Why doesn't ArrayDeque override equals() and hashCode()?