Created
December 15, 2018 09:15
-
-
Save ivancorrales/c297cf2b077fb2d12ab0b2e999b9b3c9 to your computer and use it in GitHub Desktop.
stream.Map
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
package main | |
import ( | |
"fmt" | |
"github.com/wesovilabs/koazee" | |
"strings" | |
) | |
var animals = []string{"lynx", "dog", "cat", "monkey", "dog", "fox", "tiger", "lion"} | |
func main() { | |
fmt.Printf("input: %v\n", animals) | |
stream := koazee.StreamOf(animals) | |
fmt.Print("stream.Map(strings.Title): ") | |
fmt.Println(stream.Map(strings.Title).Do().Out().Val()) | |
} | |
/** | |
go run main.go | |
input: [lynx dog cat monkey dog fox tiger lion] | |
stream.Map(strings.Title): [Lynx Dog Cat Monkey Dog Fox Tiger Lion] | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment