slice

package
v0.0.0-...-02ab814 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains[T comparable](slice []T, target T) bool

Contains returns true if the given slice contains the given element or false otherwise

func Distinct

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

Distinct removes all duplicates from the given slice

func IndexOf

func IndexOf[T comparable](slice []T, target T) int

IndexOf returns the first index of the given target in the given slice or -1 if not found

func LastIndexOf

func LastIndexOf[T comparable](slice []T, target T) int

LastIndexOf returns the last index of the given target in the given slice or -1 if not found

func Remove

func Remove[T any](slice []T, index int) []T

Remove removes the given index from the given slice

func RemoveRange

func RemoveRange[T any](slice []T, from, to int) []T

RemoveRange removes the elements in the given range from the given slice (excluding the end index)

func Reverse

func Reverse[T any](slice []T)

Reverse reverses the given slice in place

func Shuffle

func Shuffle[T any](slice []T, seed int64)

Shuffle shuffles the given slice in place

Types

This section is empty.

Jump to

Keyboard shortcuts

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