hashbimap

package
v0.0.0-...-2a10efc Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Map

type Map[K comparable, V comparable] struct {
	// contains filtered or unexported fields
}

Map is the structure that implements the map. key map to value and value map to key.

func New

func New[K comparable, V comparable]() *Map[K, V]

New returns a new hashbimap.Map.

func (*Map[K, V]) Clear

func (m *Map[K, V]) Clear()

Clear removes all key-value pairs from the map.

func (*Map[K, V]) Empty

func (m *Map[K, V]) Empty() bool

Empty returns true if the map is empty.

func (*Map[K, V]) FromJSON

func (m *Map[K, V]) FromJSON(data []byte) error

FromJSON populates list's elements from the input JSON representation.

func (*Map[K, V]) Get

func (m *Map[K, V]) Get(k K) (V, bool)

Get returns the value of the key.

func (*Map[K, V]) GetKey

func (m *Map[K, V]) GetKey(v V) (K, bool)

GetKey returns the key of the value.

func (*Map[K, V]) Keys

func (m *Map[K, V]) Keys() []K

Keys returns all keys.

func (*Map[K, V]) Put

func (m *Map[K, V]) Put(key K, value V)

Put puts the key-value pair into the map.

func (*Map[K, V]) Remove

func (m *Map[K, V]) Remove(k K)

Remove removes the key-value pair from the map.

func (*Map[K, V]) Size

func (m *Map[K, V]) Size() int

Size returns the size of the map.

func (*Map[K, V]) String

func (m *Map[K, V]) String() string

String returns a string representation of the map.

func (*Map[K, V]) ToJSON

func (m *Map[K, V]) ToJSON() ([]byte, error)

ToJSON outputs the JSON representation of list's elements.

func (*Map[K, V]) Values

func (m *Map[K, V]) Values() []V

Values returns all values.

Jump to

Keyboard shortcuts

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