summaryrefslogtreecommitdiff
path: root/libgo/go/container
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/container')
-rw-r--r--libgo/go/container/heap/heap.go9
-rw-r--r--libgo/go/container/heap/heap_test.go2
2 files changed, 7 insertions, 4 deletions
diff --git a/libgo/go/container/heap/heap.go b/libgo/go/container/heap/heap.go
index 2dfe5b43ca7..ca911396754 100644
--- a/libgo/go/container/heap/heap.go
+++ b/libgo/go/container/heap/heap.go
@@ -11,14 +11,17 @@ import "sort"
// Any type that implements heap.Interface may be used as a
// min-heap with the following invariants (established after
-// Init has been called):
+// Init has been called or if the data is empty or sorted):
//
// !h.Less(j, i) for 0 <= i < h.Len() and j = 2*i+1 or 2*i+2 and j < h.Len()
//
+// Note that Push and Pop in this interface are for package heap's
+// implementation to call. To add and remove things from the heap,
+// use heap.Push and heap.Pop.
type Interface interface {
sort.Interface
- Push(x interface{})
- Pop() interface{}
+ Push(x interface{}) // add x as element Len()
+ Pop() interface{} // remove and return element Len() - 1.
}
// A heap must be initialized before any of the heap operations
diff --git a/libgo/go/container/heap/heap_test.go b/libgo/go/container/heap/heap_test.go
index 6625e3a2b0f..cb31ef6d30a 100644
--- a/libgo/go/container/heap/heap_test.go
+++ b/libgo/go/container/heap/heap_test.go
@@ -5,8 +5,8 @@
package heap_test
import (
- "testing"
. "container/heap"
+ "testing"
)
type myHeap []int