github.com/enetx/g@v1.0.80/examples/iter/iter_contains.go (about) 1 package main 2 3 import ( 4 "fmt" 5 6 "github.com/enetx/g" 7 "github.com/enetx/g/f" 8 ) 9 10 func main() { 11 p1 := g.SliceOf("bbb", "ddd") 12 13 contains := p1.Iter().Find(f.Eq("bbb")).IsSome() 14 fmt.Println(contains) 15 16 p2 := g.SliceOf("bbb", "yyy") 17 18 containsAll := p2.Iter().All(func(v string) bool { return p1.Contains(v) }) 19 fmt.Println(containsAll) 20 21 containsAny := p2.Iter().Any(func(v string) bool { return p1.Contains(v) }) 22 fmt.Println(containsAny) 23 }