Documentation ¶
Index ¶
- func ComputeIfAbsent[K comparable, V any](m map[K]V, k K, makeValue func(key K) V) V
- func ContainsAnyKey[K comparable, V any](m map[K]V, keys ...K) bool
- func ContainsKey[K comparable, V any](m map[K]V, k K) bool
- func ConvertValues[K comparable, V any, U any](m map[K]V, convert func(key V) U) map[K]U
- func Copy[K comparable, V any](m map[K]V) map[K]V
- func Equals[K comparable, V comparable](m1 map[K]V, m2 map[K]V) bool
- func FromKeys[K comparable, V any](keys []K, makeValue func(key K) V) map[K]V
- func FromValues[K comparable, V any](values []V, extractKey func(v V) K) map[K]V
- func Get[K comparable, V any](m map[K]V, k K) gox.Optional[V]
- func Keys[K comparable, V any](m map[K]V) []K
- func PutAll[K comparable, V any](m map[K]V, entries map[K]V)
- func PutIfAbsent[K comparable, V any](m map[K]V, k K, v V) V
- func Values[K comparable, V any](m map[K]V) []V
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComputeIfAbsent ¶
func ComputeIfAbsent[K comparable, V any](m map[K]V, k K, makeValue func(key K) V) V
ComputeIfAbsent compute the value, add key-value to map, if key not exists; then return the current value.
func ContainsAnyKey ¶
func ContainsAnyKey[K comparable, V any](m map[K]V, keys ...K) bool
ContainsAnyKey return whether map contains any one of the keys
func ContainsKey ¶
func ContainsKey[K comparable, V any](m map[K]V, k K) bool
ContainsKey return whether map contains the key
func ConvertValues ¶
func ConvertValues[K comparable, V any, U any](m map[K]V, convert func(key V) U) map[K]U
ConvertValues create new map from original map, with values generated by original values and convert function.
func Equals ¶
func Equals[K comparable, V comparable](m1 map[K]V, m2 map[K]V) bool
Equals compare two maps, return true if hase same keys and values
func FromKeys ¶
func FromKeys[K comparable, V any](keys []K, makeValue func(key K) V) map[K]V
FromKeys create map from keys
func FromValues ¶
func FromValues[K comparable, V any](values []V, extractKey func(v V) K) map[K]V
FromValues create map from values
func Get ¶
func Get[K comparable, V any](m map[K]V, k K) gox.Optional[V]
Get return map value of specified key, return default value if key not exists
func PutAll ¶
func PutAll[K comparable, V any](m map[K]V, entries map[K]V)
PutAll add all key-values entries into the map. If key already exists, will be set to new value.
func PutIfAbsent ¶
func PutIfAbsent[K comparable, V any](m map[K]V, k K, v V) V
PutIfAbsent add key-value to map, if key not exists; and return the current value.
func Values ¶
func Values[K comparable, V any](m map[K]V) []V
Values return map value in a new slice
Types ¶
This section is empty.