Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test pr #2

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
)

func main() {
// Create an array list
al := list.NewArrayList()
al.Add(5, 6, 7)

Expand Down
4 changes: 2 additions & 2 deletions btree/btree.go
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,7 @@ func (n *node) iterate(dir direction, start, stop interface{}, includeStart bool
}
}
if len(n.children) > 0 {

if hit, ok = n.children[i+1].iterate(dir, start, stop, includeStart, hit, iter, cmp); !ok {
return hit, false
}
Expand All @@ -620,7 +621,7 @@ func (n *node) iterate(dir direction, start, stop interface{}, includeStart bool
return hit, false // continue
}
hit = true
if !iter(n.items[i]) {
if !iter(n.items[i] ) {
return hit, false
}
}
Expand All @@ -634,7 +635,6 @@ func (n *node) iterate(dir direction, start, stop interface{}, includeStart bool
}

// Used for testing/debugging purposes.
//nolint
func (n *node) print(w io.Writer, level int) {
fmt.Fprintf(w, "%sNODE:%v\n", strings.Repeat(" ", level), n.items)
for _, c := range n.children {
Expand Down
6 changes: 5 additions & 1 deletion map/linkedmap/linkedmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,16 @@ func (lm *linkedMap) Size() int {
}

func (lm *linkedMap) IsEmpty() bool {
return lm.Size() == 0
return lm.Size() == 0
}

func (lm *linkedMap) Put(k, v interface{}) interface{} {
var retVal interface{} = nil
if oldElement, ok := lm.data[k]; ok {




retVal = oldElement.value
oldElement.value = v
// move the element to the end of the list
Expand Down
1 change: 0 additions & 1 deletion stack/stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ func (s *stack) Pop() interface{} {
val, _ := s.l.Get(size - 1)
if _, err := s.l.Remove(size - 1); err != nil {
//todo: what should we do if failing to remove the element?
return nil
}

return val
Expand Down