Its more of a language question than data structure.
but is’nt it more accurate to .equals instead of == when comparing 2 objects?
Course: Grokking the Coding Interview: Patterns for Coding Questions - Learn Interactively
Lesson: LinkedList Cycle (easy) - Grokking the Coding Interview: Patterns for Coding Questions