gmap

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HashMap

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

func (*HashMap[K, V]) Clear

func (hm *HashMap[K, V]) Clear()

func (*HashMap[K, V]) Compute

func (hm *HashMap[K, V]) Compute(key K, f function.BiFunction[K, V, V]) (V, error)

func (*HashMap[K, V]) ContainsKey

func (hm *HashMap[K, V]) ContainsKey(key K) bool

func (*HashMap[K, V]) ContainsValue

func (hm *HashMap[K, V]) ContainsValue(value V) bool

func (*HashMap[K, V]) Get

func (hm *HashMap[K, V]) Get(key K) (V, error)

func (*HashMap[K, V]) GetOrDefault

func (hm *HashMap[K, V]) GetOrDefault(key K, defaultValue V) V

func (*HashMap[K, V]) IsEmpty

func (hm *HashMap[K, V]) IsEmpty() bool

func (*HashMap[K, V]) Iterator

func (hm *HashMap[K, V]) Iterator() iterator.Iterator[*Pair[K, V]]

func (*HashMap[K, V]) Keys

func (hm *HashMap[K, V]) Keys() (list.List[K], error)

func (*HashMap[K, V]) Put

func (hm *HashMap[K, V]) Put(key K, value V) V

func (*HashMap[K, V]) PutAll

func (hm *HashMap[K, V]) PutAll(values ...*Pair[K, V])

TODO: SHOULD IT RETURN ERROR WHEN ARGS LIST IS EMPTY?

func (*HashMap[K, V]) Remove

func (hm *HashMap[K, V]) Remove(key K) (V, error)

func (*HashMap[K, V]) RemoveWithVal

func (hm *HashMap[K, V]) RemoveWithVal(key K, value V) (V, error)

func (*HashMap[K, V]) Replace

func (hm *HashMap[K, V]) Replace(key K, newValue V) error

func (*HashMap[K, V]) ReplaceAll

func (hm *HashMap[K, V]) ReplaceAll(f function.BiFunction[K, V, V]) error

func (*HashMap[K, V]) ReplaceWithVal

func (hm *HashMap[K, V]) ReplaceWithVal(key K, oldValue V, newValue V) error

func (*HashMap[K, V]) Size

func (hm *HashMap[K, V]) Size() int64

func (*HashMap[K, V]) Values

func (hm *HashMap[K, V]) Values() (list.List[V], error)

type Map

type Map[K comparable, V comparable] interface {
	Put(key K, value V) V

	PutAll(values ...*Pair[K, V])

	Get(key K) (V, error)

	GetOrDefault(key K, defaultValue V) V

	Remove(key K) (V, error)

	RemoveWithVal(key K, value V) (V, error)

	Replace(key K, newValue V) error

	ReplaceWithVal(key K, oldValue V, newValue V) error

	ReplaceAll(f function.BiFunction[K, V, V]) error

	Compute(key K, f function.BiFunction[K, V, V]) (V, error)

	ContainsKey(key K) bool

	ContainsValue(value V) bool

	Size() int64

	Keys() (list.List[K], error)

	Values() (list.List[V], error)

	Clear()

	IsEmpty() bool

	Iterator() iterator.Iterator[*Pair[K, V]]
}

func NewHashMap

func NewHashMap[K comparable, V comparable](values ...*Pair[K, V]) Map[K, V]

type Pair

type Pair[F comparable, S comparable] struct {
	// contains filtered or unexported fields
}

func NewPair

func NewPair[F comparable, S comparable](first F, second S) *Pair[F, S]

func (Pair[F, S]) First

func (p Pair[F, S]) First() F

func (Pair[F, S]) Second

func (p Pair[F, S]) Second() S

Jump to

Keyboard shortcuts

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