-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"github.com/wesovilabs/koazee" | ||
) | ||
|
||
func main() { | ||
values := []int{1, 2, 3, 4, 5} | ||
fmt.Printf("input: %v\n", values) | ||
|
||
stream := koazee.StreamOf(values) | ||
|
||
p1, _ := stream.Contains(2) | ||
fmt.Printf("contains 2? %v\n", p1) | ||
|
||
p2, _ := stream.Contains(42) | ||
fmt.Printf("contains 42? %v\n", p2) | ||
|
||
fmt.Println() | ||
|
||
words := []string{"one", "two", "three", "four", "five"} | ||
fmt.Printf("words: %v\n", words) | ||
|
||
stream = koazee.StreamOf(words) | ||
|
||
p3, _ := stream.Contains("one") | ||
fmt.Printf("contains 'one'? %v\n", p3) | ||
|
||
p4, e1 := stream.Contains("ten") | ||
fmt.Printf("contains 'ten'? %v\n", p4) | ||
fmt.Printf("error %v\n", e1) | ||
|
||
p4, e2 := stream.Contains(42) | ||
fmt.Printf("contains 42? %v\n", p4) | ||
fmt.Printf("error %v\n", e2) | ||
} |