MCPcopy
hub / github.com/dgraph-io/dgraph / Unique

Function Unique

x/x.go:684–699  ·  view source on GitHub ↗

Unique takes an array and returns it with no duplicate entries.

(a []string)

Source from the content-addressed store, hash-verified

682
683// Unique takes an array and returns it with no duplicate entries.
684func Unique(a []string) []string {
685 if len(a) < 2 {
686 return a
687 }
688
689 sort.Strings(a)
690 idx := 1
691 for _, val := range a {
692 if a[idx-1] == val {
693 continue
694 }
695 a[idx] = val
696 idx++
697 }
698 return a[:idx]
699}
700
701// ReadLine reads a single line from a buffered reader. The line is read into the
702// passed in buffer to minimize allocations. This is the preferred

Callers 3

CommitOverNetworkFunction · 0.92
fillPredsMethod · 0.92
FillContextMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected