-
Notifications
You must be signed in to change notification settings - Fork 31
Operation reverse
Iván Corrales Solera edited this page Dec 2, 2018
·
2 revisions
It reverses the sequence of the stream elements.
func (s stream.Stream) Reverse() (out *Output)
Arguments
N/A
Output
Name | Type | Description |
---|---|---|
out | stream.Stream | It returns the stream |
Type | Description |
---|---|
err.items-nil | The stream doesn't have elements |
package main
import (
"fmt"
"github.com/wesovilabs/koazee"
)
var stream = koazee.StreamOf([]int{1, 2, 3, 4, 5})
func main() {
out := stream.Reverse().Do()
fmt.Println(out.Out().Val().([]int))
}
Reversing sequence of elements in a stream of strings
Test Identifier | Stream Len | Speed |
---|---|---|
BenchmarkReverseString10-4 | 10 | 477 ns/op |
BenchmarkReverseString100-4 | 100 | 1218 ns/op |
BenchmarkReverseString1000-4 | 1000 | 7505 ns/op |
BenchmarkReverseString5000-4 | 5000 | 37553 ns/op |
@2018 Koazee by Iván Corrales Solera [email protected]