sliceutil

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2021 License: MIT Imports: 3 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Back

func Back(arr []string) (string, []string)

Back ... string配列の後尾を切り取る

func Chunk

func Chunk(arr []string, size int) [][]string

Chunk ... string配列の分割

func Contains

func Contains(arr []string, e string) bool

Contains ... string配列の値の存在確認

func Delete

func Delete(arr []string, i int) []string

Delete ... string配列の任意の値を削除する

func Excludes

func Excludes(base []string, target []string) []string

Excludes ... string配列で指定したbaseの中でtargetに含まれない値の配列を取得

func Insert

func Insert(arr []string, v string, i int) []string

Insert ... string配列の任意の場所に挿入する

func Int64Back

func Int64Back(arr []int64) (int64, []int64)

Int64Back ... int64配列の後尾を切り取る

func Int64Chunk

func Int64Chunk(arr []int64, size int) [][]int64

Int64Chunk ... int64配列の分割

func Int64Contains

func Int64Contains(arr []int64, e int64) bool

Int64Contains ... int64配列の値の存在確認

func Int64Delete

func Int64Delete(arr []int64, i int) []int64

Int64Delete ... int64配列の任意の値を削除する

func Int64Excludes

func Int64Excludes(base []int64, target []int64) []int64

Int64Excludes ... int64配列で指定したbaseの中でtargetに含まれない値の配列を取得

func Int64Insert

func Int64Insert(arr []int64, v int64, i int) []int64

Int64Insert ... int64配列の任意の場所に挿入する

func Int64Mix

func Int64Mix(arrList [][]int64) []int64

Int64Mix ... int64配列を交互に結合する

func Int64Shift

func Int64Shift(arr []int64) (int64, []int64)

Int64Shift ... int64配列の先頭を切り取る

func Int64Shuffle

func Int64Shuffle(arr []int64) []int64

Int64Shuffle ... int64配列をシャッフルする

func Int64Uniq

func Int64Uniq(arr []int64) []int64

Int64Uniq ... int64配列の重複を排除する

func IntBack

func IntBack(arr []int) (int, []int)

IntBack ... int配列の後尾を切り取る

func IntChunk

func IntChunk(arr []int, size int) [][]int

IntChunk ... int配列の分割

func IntContains

func IntContains(arr []int, e int) bool

IntContains ... int配列の値の存在確認

func IntDelete

func IntDelete(arr []int, i int) []int

IntDelete ... int配列の任意の値を削除する

func IntExcludes

func IntExcludes(base []int, target []int) []int

IntExcludes ... int配列で指定したbaseの中でtargetに含まれない値の配列を取得

func IntInsert

func IntInsert(arr []int, v int, i int) []int

IntInsert ... int配列の任意の場所に挿入する

func IntMix

func IntMix(arrList [][]int) []int

IntMix ... int配列を交互に結合する

func IntShift

func IntShift(arr []int) (int, []int)

IntShift ... int配列の先頭を切り取る

func IntShuffle

func IntShuffle(arr []int) []int

IntShuffle ... int配列をシャッフルする

func IntUniq

func IntUniq(arr []int) []int

IntUniq ... int配列の重複を排除する

func Mix

func Mix(arrList [][]string) []string

Mix ... string配列を交互に結合する(空文字は無視)

func Shift

func Shift(arr []string) (string, []string)

Shift ... string配列の先頭を切り取る

func Shuffle

func Shuffle(arr []string) []string

Shuffle ... string配列をシャッフルする

func Uniq

func Uniq(arr []string) []string

Uniq ... string配列の重複を排除する

Types

type Stream

type Stream struct {
	// contains filtered or unexported fields
}

Stream ... スライス操作

func StreamOf

func StreamOf(slice interface{}) *Stream

StreamOf ... スライスからスライス操作を作成する

func (*Stream) Contains

func (s *Stream) Contains(fn interface{}) bool

dst := StreamOf(hoges).

    Contains(func(hoge *Hoge) bool {
		return hoge.ID == "abc"
	})

Contains ... 要素の存在確認

func (*Stream) Count

func (s *Stream) Count() int

dst := StreamOf(hoges).Count()

Count ... 要素数を取得

func (*Stream) Filter

func (s *Stream) Filter(fn interface{}) *Stream

dst := StreamOf(hoges).

Filter(func(hoge *Hoge) bool {
	return hoge.Num > 3
}).Out().([]*Hoge)

Filter ... 要素のフィルタリング

func (*Stream) ForEach

func (s *Stream) ForEach(fn interface{}) *Stream

dst := StreamOf(hoges).

    ForEach(func(hoge *Hoge, i int) {
		hoge.ID = "abc"
	})

ForEach ... 要素のループ

func (*Stream) Map

func (s *Stream) Map(fn interface{}) *Stream

dst := StreamOf(hoges).

Map(func(hoge *Hoge) string {
	return hoge.ID
}).Out().([]string)

Map ... 要素の変換

func (*Stream) Out

func (s *Stream) Out() interface{}

Out ... 結果を出力する

func (*Stream) Reduce

func (s *Stream) Reduce(fn interface{}) interface{}

dst := StreamOf(hoges).

Reduce(func(dst int, num int) int {
	return dst + num
}).(int)

Reduce ... 要素の集計

func (*Stream) Sort

func (s *Stream) Sort(fn interface{}) *Stream

dst := StreamOf(hoges).

Sort(func(prev, next *Hoge) bool {
	return prev.SortNum < next.SortNum
}).Out().([]*Hoge)

Jump to

Keyboard shortcuts

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