listutil

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllOfList

func AllOfList[T any](l *list.List) []T

AllOfList returns all elements of the given list as a slice of type T.

The caller must ensure that every element stored in the list is of type T. If an element has a different type, this function will panic at runtime.

If the list is nil or empty, an empty slice is returned.

func ListOf

func ListOf[T any](items ...T) *list.List

ListOf creates a new list.List and populates it with the provided items.

All elements are inserted in the order they appear in the argument list.

func SliceOf added in v0.0.8

func SliceOf[T any](items ...T) []T

SliceOf returns a slice containing the provided items.

func WriteStrings added in v0.0.8

func WriteStrings(w io.Writer, values ...string) error

WriteStrings writes the provided strings to w in order. It returns the first error encountered, if any.

Types

This section is empty.

Jump to

Keyboard shortcuts

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