vector

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: May 5, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package vector provides mutable.Vector constructors and helpers

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Conv

func Conv[From, To comparable](vector *mutable.Vector[From], converter func(From) (To, error)) breakStream.Iter[To]

Conv returns a breakable stream that applies the 'converter' function to the collection elements

func Convert

func Convert[From, To any](vector *mutable.Vector[From], converter func(From) To) stream.Iter[To]

Convert returns a stream that applies the 'converter' function to the collection elements

func Empty

func Empty[T any]() *mutable.Vector[T]

Empty instantiates Vector with zero capacity.

func Flat

func Flat[From, To comparable](vector *mutable.Vector[From], flattener func(From) ([]To, error)) breakStream.Iter[To]

Flat returns a breakable stream that converts the collection elements into slices and then flattens them to one level

func Flatt

func Flatt[From, To any](vector *mutable.Vector[From], flattener func(From) []To) stream.Iter[To]

Flatt returns a stream that converts the collection elements into slices and then flattens them to one level

func From

func From[T any](next func() (T, bool)) *mutable.Vector[T]

From instantiates a vector with elements retrieved by the 'next' function. The next returns an element with true or zero value with false if there are no more elements.

func NewCap

func NewCap[T any](capacity int) *mutable.Vector[T]

NewCap creates a vector with a predefined capacity.

func Of

func Of[T any](elements ...T) *mutable.Vector[T]

Of instantiates a vector with the specified elements

func Sort

func Sort[T any, F constraints.Ordered](v *mutable.Vector[T], by func(T) F) *mutable.Vector[T]

Sort sorts the specified vector in-place by a converter that thransforms an element to an Ordered (int, string and so on).

Types

This section is empty.

Jump to

Keyboard shortcuts

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