Skip to content

Instantly share code, notes, and snippets.

@ivancorrales
Last active December 15, 2018 07:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivancorrales/13639d3528f17a5d30f77b08ce0025bf to your computer and use it in GitHub Desktop.
Save ivancorrales/13639d3528f17a5d30f77b08ce0025bf to your computer and use it in GitHub Desktop.
Koazee operations: At, First and Last
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