Skip to content

Instantly share code, notes, and snippets.

@kineticz
Created January 27, 2015 10:40
Show Gist options
  • Select an option

  • Save kineticz/e7775f35957f7f3c1f0d to your computer and use it in GitHub Desktop.

Select an option

Save kineticz/e7775f35957f7f3c1f0d to your computer and use it in GitHub Desktop.
Why do I have cast o into a IntList when it is already a IntList?
@Override
public boolean equals(Object o) {
if(o == this) return true;
if(!(o instanceof IntList)) return false;
IntList that = (IntList) o;
if(this.size != that.size) return false;
for(int i = 0; i < this.size; i++) {
if(this.data[i] != that.data[i]) return false;
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment