Skip to content

Commit

Permalink
Refactor peek function in Stack.
Browse files Browse the repository at this point in the history
  • Loading branch information
trekhleb committed May 24, 2018
1 parent c8b3fb9 commit 114748b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/data-structures/stack/Stack.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default class Stack {
* @return {*}
*/
peek() {
if (!this.linkedList.tail) {
if (this.isEmpty()) {
return null;
}

Expand Down

0 comments on commit 114748b

Please sign in to comment.