-
Notifications
You must be signed in to change notification settings - Fork 31
Operation last
Iván Corrales Solera edited this page Dec 2, 2018
·
4 revisions
It returns the element in the last position.
func (s stream.Stream) Last() (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.Last()
fmt.Println(out.String())
}
Asking for element in the last position
Test Identifier | Stream Len | Speed |
---|---|---|
BenchmarkLastString10-4 | 10 | 200 ns/op |
BenchmarkLastString100-4 | 100 | 204 ns/op |
BenchmarkLastString1000-4 | 1000 | 214 ns/op |
BenchmarkLastString5000-4 | 5000 | 190 ns/op |
@2018 Koazee by Iván Corrales Solera [email protected]