maputil

package
v1.27.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 0 Imported by: 1 module, 0 packages

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 Clear

func Clear[T comparable, U any](m map[T]U)

Clear ... map を空にする

func Has

func Has[T comparable, U any](m map[T]U, key T) bool

Has ... key が存在するかどうか

func Keys

func Keys[T comparable, U any](m map[T]U) []T

Keys ... キーのslice を返す

func Values

func Values[T comparable, U any](m map[T]U) []U

Values ... 値のslice を返す

func ValuesByKeys

func ValuesByKeys[T comparable, U any](m map[T]U, keys []T) []U

ValuesByKeys ... keys slice の順番で value のslice を返す(map に存在するもののみ)

Types

type JSON

type JSON map[string]any

func (JSON) ToMap

func (j JSON) ToMap() Map[string, any]

ToMap ... JSON 型を Map 型に変換する

type Map

type Map[T comparable, U any] map[T]U

func NewMap

func NewMap[T comparable, U any](m map[T]U) Map[T, U]

NewMap ... Map を作成する

func (Map[T, U]) Clear

func (m Map[T, U]) Clear()

Clear ... Map を空にする

func (Map[T, U]) Delete

func (m Map[T, U]) Delete(key T)

Delete ... キーを削除する

func (Map[T, U]) Has

func (m Map[T, U]) Has(key T) bool

Has ... key が存在するかどうか

func (Map[T, U]) Keys

func (m Map[T, U]) Keys() []T

Keys ... キーのslice を返す

func (Map[T, U]) Len

func (m Map[T, U]) Len() int

Len ... 要素数を返す

func (Map[T, U]) Values

func (m Map[T, U]) Values() []U

Values ... 値のslice を返す

func (Map[T, U]) ValuesByKeys

func (m Map[T, U]) ValuesByKeys(keys []T) []U

ValuesByKeys ... keys slice の順番で value のslice を返す(map に存在するもののみ)

type OrderedSet added in v1.6.0

type OrderedSet[T comparable] map[T]int

func NewOrderedSet

func NewOrderedSet[T comparable](s []T) OrderedSet[T]

NewOrderedSet ... slice から orderedSet を作成する。orderedSet は Set と違い Keys() の戻り値が挿入した順になります。そのため、uniqなsliceのような扱い方もできます。

func (OrderedSet[T]) Add added in v1.6.0

func (s OrderedSet[T]) Add(key T)

Add ... キーを追加する

func (OrderedSet[T]) Clear added in v1.6.0

func (s OrderedSet[T]) Clear()

Clear ... Set を空にする

func (OrderedSet[T]) Delete added in v1.6.0

func (s OrderedSet[T]) Delete(key T)

Delete ... キーを削除する

func (OrderedSet[T]) Has added in v1.6.0

func (s OrderedSet[T]) Has(key T) bool

Has ... key が存在するかどうか

func (OrderedSet[T]) Keys added in v1.6.0

func (s OrderedSet[T]) Keys() []T

Keys ... キーのslice を返す

func (OrderedSet[T]) Len added in v1.6.0

func (s OrderedSet[T]) Len() int

Len ... 要素数を返す

type Set added in v1.6.0

type Set[T comparable] map[T]empty

func NewSet

func NewSet[T comparable](s []T) Set[T]

NewSet ... slice から Set を作成する

func (Set[T]) Add added in v1.6.0

func (s Set[T]) Add(key T)

Add ... キーを追加する

func (Set[T]) Clear added in v1.6.0

func (s Set[T]) Clear()

Clear ... Set を空にする

func (Set[T]) Delete added in v1.6.0

func (s Set[T]) Delete(key T)

Delete ... キーを削除する

func (Set[T]) Has added in v1.6.0

func (s Set[T]) Has(key T) bool

Has ... key が存在するかどうか

func (Set[T]) Keys added in v1.6.0

func (s Set[T]) Keys() []T

Keys ... キーのslice を返す

func (Set[T]) Len added in v1.6.0

func (s Set[T]) Len() int

Len ... 要素数を返す

Jump to

Keyboard shortcuts

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