Last active
December 15, 2018 07:55
-
-
Save ivancorrales/13639d3528f17a5d30f77b08ce0025bf to your computer and use it in GitHub Desktop.
Koazee operations: At, First and Last
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" | |
) | |
var numbers = []int{1, 5, 4, 3, 2, 7, 1, 8, 2, 3} | |
func main() { | |
stream := koazee.StreamOf(numbers) | |
fmt.Printf("stream.At(4): %d\n", stream.At(4).Int()) | |
fmt.Printf("stream.First: %d\n", stream.First().Int()) | |
fmt.Printf("stream.Last: %d\n", stream.Last().Int()) | |
} | |
/** | |
go run main.go | |
stream.At(4): 2 | |
stream.First: 1 | |
stream.Last: 3 | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment