mirror of
https://github.com/duke-git/lancet.git
synced 2026-02-08 06:32:28 +08:00
docs: add IsFull function for ArrayQueue
This commit is contained in:
@@ -32,6 +32,7 @@ import (
|
||||
- [Back](#ArrayQueue_Back)
|
||||
- [Front](#ArrayQueue_Size)
|
||||
- [IsEmpty](#ArrayQueue_IsEmpty)
|
||||
- [IsFull](#ArrayQueue_IsFull)
|
||||
- [Clear](#ArrayQueue_Clear)
|
||||
- [Contain](#ArrayQueue_Contain)
|
||||
|
||||
@@ -307,6 +308,38 @@ func main() {
|
||||
|
||||
|
||||
|
||||
### <span id="ArrayQueue_IsFull">IsFull</span>
|
||||
<p>Check if queue is full or not</p>
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```go
|
||||
func (q *ArrayQueue[T]) IsFull() bool
|
||||
```
|
||||
<b>Example:</b>
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
queue "github.com/duke-git/lancet/v2/datastructure/queue"
|
||||
)
|
||||
|
||||
func main() {
|
||||
q := queue.NewArrayQueue[int](3)
|
||||
fmt.Println(q.IsFull()) // false
|
||||
|
||||
q.Enqueue(1)
|
||||
q.Enqueue(2)
|
||||
q.Enqueue(3)
|
||||
|
||||
fmt.Println(q.IsFull()) // true
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
### <span id="ArrayQueue_Clear">Clear</span>
|
||||
<p>Clean all data in queue</p>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user