gods: github.com/emirpasic/gods/maps/hashmap Index | Files

package hashmap

import "github.com/emirpasic/gods/maps/hashmap"

Package hashmap implements a map backed by a hash table.

Elements are unordered in the map.

Structure is not thread safe.

Reference: http://en.wikipedia.org/wiki/Associative_array


Package Files

hashmap.go serialization.go

type Map Uses

type Map struct {
    // contains filtered or unexported fields

Map holds the elements in go's native map

func New Uses

func New() *Map

New instantiates a hash map.

func (*Map) Clear Uses

func (m *Map) Clear()

Clear removes all elements from the map.

func (*Map) Empty Uses

func (m *Map) Empty() bool

Empty returns true if map does not contain any elements

func (*Map) FromJSON Uses

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

FromJSON populates the map from the input JSON representation.

func (*Map) Get Uses

func (m *Map) Get(key interface{}) (value interface{}, found bool)

Get searches the element in the map by key and returns its value or nil if key is not found in map. Second return parameter is true if key was found, otherwise false.

func (*Map) Keys Uses

func (m *Map) Keys() []interface{}

Keys returns all keys (random order).

func (*Map) Put Uses

func (m *Map) Put(key interface{}, value interface{})

Put inserts element into the map.

func (*Map) Remove Uses

func (m *Map) Remove(key interface{})

Remove removes the element from the map by key.

func (*Map) Size Uses

func (m *Map) Size() int

Size returns number of elements in the map.

func (*Map) String Uses

func (m *Map) String() string

String returns a string representation of container

func (*Map) ToJSON Uses

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

ToJSON outputs the JSON representation of the map.

func (*Map) Values Uses

func (m *Map) Values() []interface{}

Values returns all values (random order).

Package hashmap imports 5 packages (graph) and is imported by 66 packages. Updated 2019-12-02. Refresh now. Tools for package owners.