mutable

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashMapFoldLeft

func HashMapFoldLeft[K comparable, V any, T any](
	src HashMap[K, V],
	dst T,
	p func(T, K, V) T,
) T

func SeqFoldLeft

func SeqFoldLeft[T1 any, T2 any](
	src Sequence[T1],
	dst T2,
	p func(T2, int, T1) T2,
) T2

Types

type HashMap

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

HashMap is a container for an optional Values of type V. If Values exists, HashMap is of type Some. If the Values is absent, HashMap is of type None.

func NewMap

func NewMap[K comparable, V any]() HashMap[K, V]

NewMap Builds a HashMap

func ToMap

func ToMap[K comparable, V any](data map[K]V) HashMap[K, V]

func (HashMap[K, V]) Contains

func (o HashMap[K, V]) Contains(s V) bool

func (HashMap[K, V]) Filter

func (o HashMap[K, V]) Filter(f func(K, V) bool) HashMap[K, V]

func (HashMap[K, V]) Find

func (o HashMap[K, V]) Find(f func(K, V) bool) mo.Option[tuple.T2[K, V]]

func (HashMap[K, V]) FoldLeft

func (o HashMap[K, V]) FoldLeft(z HashMap[K, V], f func(HashMap[K, V], K, V) HashMap[K, V]) HashMap[K, V]

func (HashMap[K, V]) Get

func (o HashMap[K, V]) Get(k K) mo.Option[tuple.T2[K, V]]

func (HashMap[K, V]) GetOrElse

func (o HashMap[K, V]) GetOrElse(k K, def V) V

func (*HashMap[K, V]) GobDecode

func (o *HashMap[K, V]) GobDecode(data []byte) error

func (HashMap[K, V]) GobEncode

func (o HashMap[K, V]) GobEncode() ([]byte, error)

func (HashMap[K, V]) HasKey

func (o HashMap[K, V]) HasKey(k K) bool

func (HashMap[K, V]) IsEmpty

func (o HashMap[K, V]) IsEmpty() bool

func (HashMap[K, V]) Join

func (o HashMap[K, V]) Join(m HashMap[K, V]) HashMap[K, V]

func (HashMap[K, V]) Keys

func (o HashMap[K, V]) Keys() Sequence[K]

func (HashMap[K, V]) Map

func (o HashMap[K, V]) Map(f func(K, V) V) HashMap[K, V]

HashMap executes the mapper function if Values is present or returns None if absent.

func (HashMap[K, V]) Remove

func (o HashMap[K, V]) Remove(key K) HashMap[K, V]

func (HashMap[K, V]) Size

func (o HashMap[K, V]) Size() int

Size returns 1 when Values is present or 0 instead.

func (HashMap[K, V]) ToMap

func (o HashMap[K, V]) ToMap() map[K]V

func (HashMap[K, V]) ToSequence

func (o HashMap[K, V]) ToSequence() Sequence[tuple.T2[K, V]]

func (HashMap[K, V]) ToSlice

func (o HashMap[K, V]) ToSlice() []tuple.T2[K, V]

func (HashMap[K, V]) Update

func (o HashMap[K, V]) Update(key K, value V) HashMap[K, V]

func (HashMap[K, V]) Values

func (o HashMap[K, V]) Values() Sequence[V]

type Sequence

type Sequence[V any] struct {
	// contains filtered or unexported fields
}

Sequence is a container for an optional items of type V. If items exists, Sequence is of type V. If the items is absent, Sequence is of type None.

func NewSequence

func NewSequence[V any](values ...V) Sequence[V]

func (Sequence[V]) Append

func (o Sequence[V]) Append(values ...V) Sequence[V]

func (Sequence[V]) Contains

func (o Sequence[V]) Contains(e V) bool

func (Sequence[V]) Filter

func (o Sequence[V]) Filter(p func(V) bool) Sequence[V]

func (Sequence[V]) FilterWithIndex

func (o Sequence[V]) FilterWithIndex(p func(int, V) bool) Sequence[V]

func (Sequence[V]) Find

func (o Sequence[V]) Find(f func(V) bool) mo.Option[V]

func (Sequence[V]) FindWithIndex

func (o Sequence[V]) FindWithIndex(f func(int, V) bool) mo.Option[tuple.T2[int, V]]

func (Sequence[V]) FoldLeft

func (o Sequence[V]) FoldLeft(z Sequence[V], p func(Sequence[V], int, V) Sequence[V]) Sequence[V]

func (Sequence[V]) FoldRight

func (o Sequence[V]) FoldRight(z Sequence[V], p func(Sequence[V], int, V) Sequence[V]) Sequence[V]

func (Sequence[V]) Head

func (o Sequence[V]) Head() mo.Option[V]

Head returns first element as an Option.

func (Sequence[V]) Index

func (o Sequence[V]) Index(i int) mo.Option[V]

func (Sequence[V]) IndexOf

func (o Sequence[V]) IndexOf(e V) (int, bool)

IndexOf Search the pairs for a given value and return position, if not found returns -1

func (Sequence[V]) IsEmpty

func (o Sequence[V]) IsEmpty() bool

func (Sequence[V]) Join

func (o Sequence[V]) Join(seq Sequence[V]) Sequence[V]

func (Sequence[V]) Map

func (o Sequence[V]) Map(f func(V) V) Sequence[V]

func (Sequence[V]) MapWithIndex

func (o Sequence[V]) MapWithIndex(f func(int, V) V) Sequence[V]

func (Sequence[V]) Reversed

func (o Sequence[V]) Reversed() Sequence[V]

func (Sequence[V]) Size

func (o Sequence[V]) Size() int

Size returns len() of items.

func (Sequence[V]) Sort

func (o Sequence[V]) Sort(f func(v1, v2 V) bool) Sequence[V]

func (Sequence[V]) Tail

func (o Sequence[V]) Tail() Sequence[V]

Tail returns last elements as an Sequence[V].

func (Sequence[V]) ToSlice

func (o Sequence[V]) ToSlice() []V

func (Sequence[V]) Unique

func (o Sequence[V]) Unique() Sequence[V]

Jump to

Keyboard shortcuts

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