Add contains
This commit is contained in:
		@@ -73,3 +73,16 @@ func (rb *RingBuffer) GetLastPosition() int {
 | 
			
		||||
	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
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user