1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-15 02:02:27 +08:00

feat: and Clear and IsEmpty func

This commit is contained in:
dudaodong
2022-02-10 17:41:51 +08:00
parent ade567a620
commit 85e1f711f5
8 changed files with 64 additions and 8 deletions

View File

@@ -226,3 +226,14 @@ func (link *DoublyLink[T]) Print() {
info += " ]"
fmt.Println(info)
}
// IsEmpty checks if link is empty or not
func (link *DoublyLink[T]) IsEmpty() bool {
return link.length == 0
}
// IsEmpty checks if link is empty or not
func (link *DoublyLink[T]) Clear() {
link.Head = nil
link.length = 0
}