Skip to content
This repository was archived by the owner on May 25, 2021. It is now read-only.

Stack class optimization of clear method. #830

Closed
rajinder-yadav opened this issue Nov 28, 2016 · 0 comments
Closed

Stack class optimization of clear method. #830

rajinder-yadav opened this issue Nov 28, 2016 · 0 comments
Assignees
Milestone

Comments

@rajinder-yadav
Copy link
Contributor

rajinder-yadav commented Nov 28, 2016

clear method create's a copy and return an array that gets GCed, better to simply assign an empty array.

clear() {
  this.elements = [];
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants