-
Notifications
You must be signed in to change notification settings - Fork 31
Operation first
Iván Corrales Solera edited this page Dec 2, 2018
·
10 revisions
It returns the element in the first position.
func (s stream.Stream) First() (out *Output)
Arguments
N/A
Output
Name | Type | Description |
---|---|---|
out | *stream.Output | It's a pointer to the below structure |
type Output struct {
value reflect.Value
error *errors.Error
}
Type | Description |
---|---|
err.items-nil | The stream doesn't have elements |
package main
import (
"fmt"
"github.com/wesovilabs/koazee"
)
var stream = koazee.StreamOf([]string{"Dog","Cat","Monkey","Rabbit","Turtle"})
func main() {
out:=stream.First()
fmt.Println(out.String())
}
Asking for element in the first position
Test Identifier | Stream Len | Speed |
---|---|---|
BenchmarkFirstString10-4 | 10 | 235 ns/op |
BenchmarkFirstString100-4 | 100 | 191 ns/op |
BenchmarkFirstString1000-4 | 1000 | 370 ns/op |
BenchmarkFirstString5000-4 | 5000 | 259 ns/op |
@2018 Koazee by Iván Corrales Solera [email protected]