Repository navigation
Operation removeDuplicates
Iván Corrales Solera edited this page Dec 2, 2018
·
1 revision
It removes duplicated elements
func (s stream.Stream) RemoveDuplicated() (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{"Criminal", "Hunter", "BullFighter", "Murderer", "Hunter"})
func main() {
stream = stream.RemoveDuplicates().Do()
for _, c := range stream.Out().Val().([]string) {
fmt.Printf("STOP %s\n", c)
}
}Removing duplicated elements in a stream of strings
| Test Identifier | Stream Len | Speed |
|---|---|---|
| BenchmarkDuplicatedString10-4 | 10 | 4695 ns/op |
| BenchmarkDuplicatedString10-4 | 100 | 39628 ns/op |
| BenchmarkDuplicatedString10-4 | 1000 | 413261 ns/op |
| BenchmarkDuplicatedString10-4 | 5000 | 2436386 ns/op |
@2018 Koazee by Iván Corrales Solera developer@wesovilabs.com