Documentation ¶ Index ¶ type IntQueue func (q *IntQueue) IsEmpty() bool func (q *IntQueue) Pop() int func (q *IntQueue) Push(v int) Examples ¶ IntQueue.Push Constants ¶ This section is empty. Variables ¶ This section is empty. Functions ¶ This section is empty. Types ¶ type IntQueue ¶ type IntQueue []int IntQueue 使用别名方式扩充slice实现整型队列 func (*IntQueue) IsEmpty ¶ func (q *IntQueue) IsEmpty() bool IsEmpty 队列是否为空 func (*IntQueue) Pop ¶ func (q *IntQueue) Pop() int Pop 出队 func (*IntQueue) Push ¶ func (q *IntQueue) Push(v int) Push 入队 e.g. q.Push(123) Example ¶ ExampleIntQueue_Push 是对 IntQueue 的 Push() 方法的示例, 测试时会检查注释中的 Output 是否正确, godoc 中也会展示在 Example 区。 q := IntQueue{1} q.Push(12) q.Push(22) fmt.Println(q.IsEmpty()) fmt.Println(q.Pop()) Output: false 1 Source Files ¶ View all Source files intqueue.go Click to show internal directories. Click to hide internal directories.