We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2a406c5 commit ce0db07Copy full SHA for ce0db07
ds/minislice.go
@@ -56,6 +56,12 @@ func (s *MiniSlice[A, T]) Append(val T) {
56
s.nextArrayIdx++
57
}
58
59
+// Returns true if the slice has the requested value
60
+func (s *MiniSlice[A, T]) Contains(searchVal T) bool {
61
+ // Logic: If we return a positive value, then we must have found it
62
+ return (s.Find(searchVal) >= 0)
63
+}
64
+
65
// Find and return the index of the first element, else return -1
66
func (s *MiniSlice[A, T]) Find(searchVal T) int {
67
for i, val := range s.All() {
0 commit comments