From d90ba18823e141907a88ddd1b1a533296e7a8a49 Mon Sep 17 00:00:00 2001 From: "Chih Hong, Chen" Date: Tue, 12 Nov 2019 13:50:17 +0800 Subject: [PATCH] [golang] Simplify stack IsEmpty function IsEmpty function can be simplified to one line, which is clearer. --- go/08_stack/StackBasedOnLinkedList.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/go/08_stack/StackBasedOnLinkedList.go b/go/08_stack/StackBasedOnLinkedList.go index ef4fef4..4101c9e 100644 --- a/go/08_stack/StackBasedOnLinkedList.go +++ b/go/08_stack/StackBasedOnLinkedList.go @@ -20,10 +20,7 @@ func NewLinkedListStack() *LinkedListStack { } func (this *LinkedListStack) IsEmpty() bool { - if this.topNode == nil { - return true - } - return false + return this.topNode == nil } func (this *LinkedListStack) Push(v interface{}) {