treemap

package
v0.0.0-...-118d4d9 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2016 License: BSD-2-Clause Imports: 3 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 struct {
	// contains filtered or unexported fields
}

func NewWith

func NewWith(comparator utils.Comparator) *Map

Instantiates a tree map with the custom comparator.

func NewWithIntComparator

func NewWithIntComparator() *Map

Instantiates a tree map with the IntComparator, i.e. keys are of type int.

func NewWithStringComparator

func NewWithStringComparator() *Map

Instantiates a tree map with the StringComparator, i.e. keys are of type string.

func (*Map) Clear

func (m *Map) Clear()

Removes all elements from the map.

func (*Map) Empty

func (m *Map) Empty() bool

Returns true if map does not contain any elements

func (*Map) Get

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

Searches the element in the map by key and returns its value or nil if key is not found in tree. Second return parameter is true if key was found, otherwise false. Key should adhere to the comparator's type assertion, otherwise method panics.

func (*Map) Keys

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

Returns all keys in-order

func (*Map) Put

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

Inserts key-value pair into the map. Key should adhere to the comparator's type assertion, otherwise method panics.

func (*Map) Remove

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

Remove the element from the map by key. Key should adhere to the comparator's type assertion, otherwise method panics.

func (*Map) Size

func (m *Map) Size() int

Returns number of elements in the map.

func (*Map) String

func (m *Map) String() string

func (*Map) Values

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

Returns all values in-order based on the key.

Jump to

Keyboard shortcuts

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