hashablemaps

package
v0.12.6 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package hashablemaps offers tools for handling and manipulating map data structures with hashable keys.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add[H godash.Hashable](m *HashableMap[H], v H)

Add adds the key value pair to the HashableMap. Modifies the map in place, does not return a new HashableMap.

func AddAll

func AddAll[H godash.Hashable](m *HashableMap[H], v ...H)

AddAll adds a new element to the HashableMap. Modifies the map in place, does not return a new HashableMap.

func Contains

func Contains[H godash.Hashable](m HashableMap[H], key string) bool

Contains returns true if the hashmap contains the key.

func FromHashableMap

func FromHashableMap[H godash.Hashable](m HashableMap[H]) (ps []godash.Pair[string, H])

FromHashableMap returns an array of the key value pairs in the map.

func Keys

func Keys[H godash.Hashable](m HashableMap[H]) []string

Keys returns a slice of the keys in the HashableMap.

func Remove

func Remove[H godash.Hashable](m *HashableMap[H], key string)

Remove removes the key and associated value from the HashableMap.

func RemoveAll

func RemoveAll[H godash.Hashable](m *HashableMap[H], ks ...string)

RemoveAll removes the keys with the associated values from the HashableMap.

func Values

func Values[H godash.Hashable](m HashableMap[H]) []H

Values returns a slice of the values in the HashableMap.

Types

type HashableMap

type HashableMap[H godash.Hashable] map[string]H

HashableMap is a map of Hashable objects, where the key is the hash of the object.

func ToHashableMap

func ToHashableMap[H godash.Hashable](hs []H) (m HashableMap[H])

ToHashableMap returns a map of the key value pairs passed in.

Jump to

Keyboard shortcuts

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