Pop removes top element on heap and returns it, or nil if heap is empty. Second return parameter is true, unless the heap was empty and there was nothing to pop.
()
| 62 | // Pop removes top element on heap and returns it, or nil if heap is empty. |
| 63 | // Second return parameter is true, unless the heap was empty and there was nothing to pop. |
| 64 | func (h *commitNodeHeap) Pop() (CommitNode, bool) { |
| 65 | c, ok := h.Heap.Pop() |
| 66 | if !ok { |
| 67 | return nil, false |
| 68 | } |
| 69 | return c.(CommitNode), true |
| 70 | } |
| 71 | |
| 72 | // Peek returns top element on the heap without removing it, or nil if heap is empty. |
| 73 | // Second return parameter is true, unless the heap was empty and there was nothing to peek. |