From d54f27d9a9bdc461d40e6861181ab661234f76cf Mon Sep 17 00:00:00 2001 From: dudaodong Date: Sun, 5 Jun 2022 16:46:01 +0800 Subject: [PATCH] docs: add IsFull function for ArrayQueue --- docs/datastructure/queue.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/docs/datastructure/queue.md b/docs/datastructure/queue.md index bfd7e5f..8ce4c84 100644 --- a/docs/datastructure/queue.md +++ b/docs/datastructure/queue.md @@ -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() { +### IsFull +

Check if queue is full or not

+ +Signature: + +```go +func (q *ArrayQueue[T]) IsFull() bool +``` +Example: + +```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 +} +``` + + + ### Clear

Clean all data in queue