sliceutil

package
v3.0.0-alpha.63 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package sliceutil provides generic utility functions not available in stdlib. For most slice operations, use the standard library "slices" package directly. This package only contains functions that have no stdlib equivalent.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindMapKey

func FindMapKey[K comparable, V comparable](m map[K]V, val V) (K, bool)

FindMapKey returns the first key in map m whose value equals val. FindMapKey returns the first key in m whose value equals val. If no such key exists it returns the zero value of K and false. If multiple keys map to val, the returned key depends on Go's map iteration order.

func Unique

func Unique[T comparable](slice []T) []T

Unique returns a new slice with duplicate elements removed. Preserves the order of first occurrence. The original slice is not modified.

Unique returns a new slice containing the first occurrence of each element from the input slice, preserving their original order. If the input slice is nil, Unique returns nil. The original slice is not modified.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL