From 076c527d931f9e9307bdc553152cc834bbd184ab Mon Sep 17 00:00:00 2001 From: Emir Pasic Date: Sun, 17 Jun 2018 14:41:40 +0200 Subject: [PATCH] Revert "gofmt" --- lists/arraylist/arraylist.go | 13 ++++++------- lists/arraylist/arraylist_test.go | 16 ++++++++-------- lists/doublylinkedlist/doublylinkedlist.go | 1 - lists/doublylinkedlist/doublylinkedlist_test.go | 16 ++++++++-------- lists/singlylinkedlist/singlylinkedlist.go | 3 +-- lists/singlylinkedlist/singlylinkedlist_test.go | 16 ++++++++-------- 6 files changed, 31 insertions(+), 34 deletions(-) diff --git a/lists/arraylist/arraylist.go b/lists/arraylist/arraylist.go index 9cb98d8..e2fbcec 100644 --- a/lists/arraylist/arraylist.go +++ b/lists/arraylist/arraylist.go @@ -99,18 +99,17 @@ func (list *List) Values() []interface{} { } //IndexOf returns index of provided element -func (list *List) IndexOf(value interface{}) int { +func (list *List) IndexOf(value interface{}) int{ if list.size == 0 { return -1 } - for index, element := range list.elements { - if element == value { - return index + for index, element := range list.elements { + if element == value { + return index + } } - } - return -1 + return -1 } - // Empty returns true if list does not contain any elements. func (list *List) Empty() bool { return list.size == 0 diff --git a/lists/arraylist/arraylist_test.go b/lists/arraylist/arraylist_test.go index 3e31e3d..abbb2aa 100644 --- a/lists/arraylist/arraylist_test.go +++ b/lists/arraylist/arraylist_test.go @@ -30,26 +30,26 @@ func TestListIndexOf(t *testing.T) { list := New() expectedIndex := -1 - if index := list.IndexOf("a"); index != expectedIndex { - t.Errorf("Got %v expected %v", index, expectedIndex) + if index := list.IndexOf("a"); index != expectedIndex{ + t.Errorf("Got %v expected %v",index,expectedIndex) } list.Add("a") list.Add("b", "c") expectedIndex = 0 - if index := list.IndexOf("a"); index != expectedIndex { - t.Errorf("Got %v expected %v", index, expectedIndex) + if index := list.IndexOf("a"); index != expectedIndex{ + t.Errorf("Got %v expected %v",index,expectedIndex) } expectedIndex = 1 - if index := list.IndexOf("b"); index != expectedIndex { - t.Errorf("Got %v expected %v", index, expectedIndex) + if index := list.IndexOf("b"); index != expectedIndex{ + t.Errorf("Got %v expected %v",index,expectedIndex) } expectedIndex = 2 - if index := list.IndexOf("c"); index != expectedIndex { - t.Errorf("Got %v expected %v", index, expectedIndex) + if index := list.IndexOf("c"); index != expectedIndex{ + t.Errorf("Got %v expected %v",index,expectedIndex) } } diff --git a/lists/doublylinkedlist/doublylinkedlist.go b/lists/doublylinkedlist/doublylinkedlist.go index ab0e1bc..881e0f7 100644 --- a/lists/doublylinkedlist/doublylinkedlist.go +++ b/lists/doublylinkedlist/doublylinkedlist.go @@ -185,7 +185,6 @@ func (list *List) IndexOf(value interface{}) int { } return -1 } - // Empty returns true if list does not contain any elements. func (list *List) Empty() bool { return list.size == 0 diff --git a/lists/doublylinkedlist/doublylinkedlist_test.go b/lists/doublylinkedlist/doublylinkedlist_test.go index 4794da9..444e272 100644 --- a/lists/doublylinkedlist/doublylinkedlist_test.go +++ b/lists/doublylinkedlist/doublylinkedlist_test.go @@ -137,26 +137,26 @@ func TestListIndexOf(t *testing.T) { list := New() expectedIndex := -1 - if index := list.IndexOf("a"); index != expectedIndex { - t.Errorf("Got %v expected %v", index, expectedIndex) + if index := list.IndexOf("a"); index != expectedIndex{ + t.Errorf("Got %v expected %v",index,expectedIndex) } list.Add("a") list.Add("b", "c") expectedIndex = 0 - if index := list.IndexOf("a"); index != expectedIndex { - t.Errorf("Got %v expected %v", index, expectedIndex) + if index := list.IndexOf("a"); index != expectedIndex{ + t.Errorf("Got %v expected %v",index,expectedIndex) } expectedIndex = 1 - if index := list.IndexOf("b"); index != expectedIndex { - t.Errorf("Got %v expected %v", index, expectedIndex) + if index := list.IndexOf("b"); index != expectedIndex{ + t.Errorf("Got %v expected %v",index,expectedIndex) } expectedIndex = 2 - if index := list.IndexOf("c"); index != expectedIndex { - t.Errorf("Got %v expected %v", index, expectedIndex) + if index := list.IndexOf("c"); index != expectedIndex{ + t.Errorf("Got %v expected %v",index,expectedIndex) } } diff --git a/lists/singlylinkedlist/singlylinkedlist.go b/lists/singlylinkedlist/singlylinkedlist.go index 45ee69c..3182af3 100644 --- a/lists/singlylinkedlist/singlylinkedlist.go +++ b/lists/singlylinkedlist/singlylinkedlist.go @@ -155,7 +155,7 @@ func (list *List) Values() []interface{} { } //IndexOf returns index of provided element -func (list *List) IndexOf(value interface{}) int { +func (list *List) IndexOf(value interface{}) int{ if list.size == 0 { return -1 } @@ -166,7 +166,6 @@ func (list *List) IndexOf(value interface{}) int { } return -1 } - // Empty returns true if list does not contain any elements. func (list *List) Empty() bool { return list.size == 0 diff --git a/lists/singlylinkedlist/singlylinkedlist_test.go b/lists/singlylinkedlist/singlylinkedlist_test.go index 36e080d..0bebbb3 100644 --- a/lists/singlylinkedlist/singlylinkedlist_test.go +++ b/lists/singlylinkedlist/singlylinkedlist_test.go @@ -137,26 +137,26 @@ func TestListIndexOf(t *testing.T) { list := New() expectedIndex := -1 - if index := list.IndexOf("a"); index != expectedIndex { - t.Errorf("Got %v expected %v", index, expectedIndex) + if index := list.IndexOf("a"); index != expectedIndex{ + t.Errorf("Got %v expected %v",index,expectedIndex) } list.Add("a") list.Add("b", "c") expectedIndex = 0 - if index := list.IndexOf("a"); index != expectedIndex { - t.Errorf("Got %v expected %v", index, expectedIndex) + if index := list.IndexOf("a"); index != expectedIndex{ + t.Errorf("Got %v expected %v",index,expectedIndex) } expectedIndex = 1 - if index := list.IndexOf("b"); index != expectedIndex { - t.Errorf("Got %v expected %v", index, expectedIndex) + if index := list.IndexOf("b"); index != expectedIndex{ + t.Errorf("Got %v expected %v",index,expectedIndex) } expectedIndex = 2 - if index := list.IndexOf("c"); index != expectedIndex { - t.Errorf("Got %v expected %v", index, expectedIndex) + if index := list.IndexOf("c"); index != expectedIndex{ + t.Errorf("Got %v expected %v",index,expectedIndex) } }