slicex

package module
v1.0.14 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2023 License: MIT Imports: 1 Imported by: 1

README

slicex

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Chunk

func Chunk[S ~[]E, E any](s S, size int) []S

func Concat added in v1.0.10

func Concat[S ~[]E, E any](ss ...S) S

func ContainsFunc added in v1.0.9

func ContainsFunc[E any](s []E, f func(E) bool) bool

ContainsFunc reports whether v is present in s.

func Filter added in v1.0.11

func Filter[S ~[]E, E any](s S, f func(int, E) bool) S

func IsEmpty

func IsEmpty[S ~[]E, E any](s S) bool

IsEmpty Checks if an slice is nil or length equals 0

func IsNotEmpty added in v1.0.6

func IsNotEmpty[S ~[]E, E any](s S) bool

func Map added in v1.0.1

func Map[S1 ~[]E1, S2 ~[]E2, E1 any, E2 any](s S1, f func(int, E1) E2) S2

Map 方法创建一个新数组,这个新数组由原数组中的每个元素都调用一次提供的函数后的返回值组成。

func NotContains added in v1.0.12

func NotContains[E comparable](s []E, v E) bool

NotContains reports whether v is not present in s.

func NotContainsFunc added in v1.0.13

func NotContainsFunc[E any](s []E, f func(E) bool) bool

NotContainsFunc reports whether v is not present in s.

func Reduce added in v1.0.11

func Reduce[S ~[]E, E any, R any](s S, initValue R, f func(R, int, E) R) R

func Reverse added in v1.0.8

func Reverse[S ~[]E, E comparable](s S) S

func ToMap added in v1.0.3

func ToMap[S ~[]E, M ~map[K]E, E any, K comparable](s S, f func(int, E) K) M

ToMap 方法创建一个Map,这个Map由原数组中的每个元素都调用一次提供的函数后的返回值作为Key、每个元素作为Value组成。

func Uniq added in v1.0.7

func Uniq[S ~[]E, E comparable](s S) S

Types

type Stream added in v1.0.11

type Stream struct {
}

TODO Stream

Jump to

Keyboard shortcuts

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