Documentation ¶
Overview ¶
Package unique provides primitives for finding unique elements of types that implement sort.Interface.
Index ¶
- func Float64s(a *[]float64)
- func Float64sAreUnique(a []float64) bool
- func Ints(a *[]int)
- func IntsAreUnique(a []int) bool
- func IsUniqued(data sort.Interface) bool
- func Sort(data Interface)
- func Strings(a *[]string)
- func StringsAreUnique(a []string) bool
- func ToFront(data sort.Interface) (n int)
- func Unique(data Interface)
- type Float64Slice
- type IntSlice
- type Interface
- type StringSlice
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Float64s ¶
func Float64s(a *[]float64)
Float64s removes duplicate elements from a sorted slice of float64s.
func Float64sAreUnique ¶
Float64sAreUnique tests whether a slice of float64s is sorted and its elements are unique.
func IntsAreUnique ¶
IntsAreUnique tests whether a slice of ints is sorted and its elements are unique.
func Strings ¶
func Strings(a *[]string)
Strings removes duplicate elements from a sorted slice of strings.
func StringsAreUnique ¶
StringsAreUnique tests whether a slice of strings is sorted and its elements are unique.
Types ¶
type Float64Slice ¶
type Float64Slice struct{ P *[]float64 }
Float64Slice attaches the methods of Interface to []float64.
func (Float64Slice) Len ¶
func (p Float64Slice) Len() int
func (Float64Slice) Less ¶
func (p Float64Slice) Less(i, j int) bool
func (Float64Slice) Swap ¶
func (p Float64Slice) Swap(i, j int)
func (Float64Slice) Truncate ¶
func (p Float64Slice) Truncate(n int)
type IntSlice ¶
type IntSlice struct{ P *[]int }
IntSlice attaches the methods of Interface to []int.
type Interface ¶
type Interface interface { sort.Interface // Truncate reduces the length to the first n elements. Truncate(n int) }
Types that implement unique.Interface can have duplicate elements removed by the functionality in this package.
type StringSlice ¶
type StringSlice struct{ P *[]string }
StringSlice attaches the methods of Interface to []string.
func (StringSlice) Len ¶
func (p StringSlice) Len() int
func (StringSlice) Less ¶
func (p StringSlice) Less(i, j int) bool
func (StringSlice) Swap ¶
func (p StringSlice) Swap(i, j int)
func (StringSlice) Truncate ¶
func (p StringSlice) Truncate(n int)