-
Notifications
You must be signed in to change notification settings - Fork 31
Operation count
Iván Corrales Solera edited this page Dec 2, 2018
·
1 revision
It returns the number of elements in the stream.
func (s stream.Stream) Count() (total int,err *errors.Error)
Arguments
N/A
Output
Name | Type | Description |
---|---|---|
total | int | Number of elements |
err | *errors.Error | Error in case of something didn't work |
Type | Description |
---|---|
err.items-nil | Count of a nil stream is not permitted |
package main
import (
"fmt"
"github.com/wesovilabs/koazee"
)
var stream = koazee.StreamOf([]string{"Dog","Cat","Monkey","Rabbit","Turtle"})
func main() {
count,_:=stream.Count()
fmt.Println(count)
}
Counting the number of elements in a stream o strings
Test Identifier | Stream Len | Speed |
---|---|---|
BenchmarkCountString10-4 | 10 | 101 ns/op |
BenchmarkCountString10-4 | 100 | 98.6 ns/op |
BenchmarkCountString10-4 | 1000 | 108 ns/op |
BenchmarkCountString10-4 | 5000 | 96.5 ns/op |
@2018 Koazee by Iván Corrales Solera [email protected]