orders

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2025 License: Apache-2.0 Imports: 2 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
}

Map represents an associative array or map abstract data type.

func (*Map) Empty

func (m *Map) Empty() bool

Empty return if the map in empty or not.

func (*Map) Get

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

Get returns the value of a key from the Map.

func (*Map) Keys

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

Keys return the keys in the map in insertion order.

func (*Map) Put

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

Put adds items to the map.

If a key is found in the map it replaces it value.

func (*Map) Remove

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

Remove deletes a key-value pair from the Map.

If a key is not found in the map it doesn't fails, just does nothing.

func (*Map) Size

func (m *Map) Size() int

Size return the map number of key-value pairs.

func (*Map) String

func (m *Map) String() string

String implements Stringer interface.

Prints the map string representation, a concatenated string of all its string representation values in insertion order.

func (*Map) Values

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

Values return the values in the map in insertion order.

type Order

type Order interface {
	Size() int
	Empty() bool
	Values() []interface{}
	String() string
}

type OrderMap

type OrderMap interface {
	Put(key interface{}, value interface{})
	Get(key interface{}) (value interface{}, found bool)
	Remove(key interface{})
	Keys() []interface{}

	Order
}

func NewOrderedMap

func NewOrderedMap() OrderMap

NewOrderedMap creates a new empty Map.

type OrderSet

type OrderSet interface {
	Add(items ...interface{})
	Contains(items ...interface{}) bool
	Remove(items ...interface{})

	Order
}

func NewOrderedSet

func NewOrderedSet() OrderSet

NewOrderedSet creates a new empty Set.

type Set

type Set struct {
	// contains filtered or unexported fields
}

Set represents a dynamic, insertion-ordered, set abstract data type.

func (*Set) Add

func (s *Set) Add(items ...interface{})

Add adds items to the set.

If an item is found in the set it replaces it.

func (*Set) Contains

func (s *Set) Contains(items ...interface{}) bool

Get return if set contains the specified items or not.

func (*Set) Empty

func (s *Set) Empty() bool

Empty return if the set in empty or not.

func (*Set) Remove

func (s *Set) Remove(items ...interface{})

Remove deletes items from the set.

If an item is not found in the set it doesn't fails, just does nothing.

func (*Set) Size

func (s *Set) Size() int

Size return the set number of elements.

func (*Set) String

func (s *Set) String() string

String implements Stringer interface.

Prints the set string representation, a concatenated string of all its string representation values in insertion order.

func (*Set) Values

func (s *Set) Values() []interface{}

Values return the set values in insertion order.

Jump to

Keyboard shortcuts

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