Compare commits

...

2 Commits

Author SHA1 Message Date
e0e5a72e90
Merge remote-tracking branch 'origin/main' 2024-06-18 17:38:56 +02:00
62bafd9af7
Add contains 2024-06-18 17:38:01 +02:00

View File

@ -73,3 +73,16 @@ func (rb *RingBuffer) GetLastPosition() int {
return rb.tail return rb.tail
} }
func (rb *RingBuffer) ContainsItem(item string) bool {
rb.mu.Lock()
defer rb.mu.Unlock()
for i := 0; i < rb.size; i++ {
index := (rb.head + i) % rb.size
if rb.buffer[index] == item {
return true
}
}
return false
}