structure

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Array

type Array[T ArrayElemType] interface {
	// RemoveDuplicates 去重
	RemoveDuplicates()
	// Array 返回实例
	Array() []T
	// Join 逗号分隔(默认是逗号分隔)
	Join(sep string) string
}

Array 列表

func NewArray

func NewArray[T ArrayElemType]() Array[T]

func NewFromArray

func NewFromArray[T ArrayElemType](arr []T) Array[T]

type ArrayElemType

type ArrayElemType interface {
	byte | int8 | int16 | int32 | int64 | int | string
}

type Entry

type Entry struct {
	Key   string
	Value any
}

type OrderedSet

type OrderedSet[T OrderedSetElemType] interface {
	Exist(target T) bool
	AddOne(elem T)
	Add(elems ...T)
	Len() int
	Cap() int
	AllElements() []T
}

OrderedSet 有序集合

func NewOrderedSet

func NewOrderedSet[T OrderedSetElemType]() OrderedSet[T]

func NewOrderedSetWithCap

func NewOrderedSetWithCap[T OrderedSetElemType](cap int) OrderedSet[T]

type OrderedSetElemType

type OrderedSetElemType interface {
	byte | int8 | int16 | int32 | int64 | int | string
}

type SortedMap

type SortedMap struct {
	Entries []Entry
}

func (*SortedMap) Append

func (sm *SortedMap) Append(key string, value any)

func (*SortedMap) Get

func (sm *SortedMap) Get(key string) (any, bool)

func (*SortedMap) Len

func (sm *SortedMap) Len() int

func (*SortedMap) Less

func (sm *SortedMap) Less(i, j int) bool

func (*SortedMap) Remove

func (sm *SortedMap) Remove(key string)

func (*SortedMap) Set

func (sm *SortedMap) Set(key string, value any) (any, bool)

func (*SortedMap) Swap

func (sm *SortedMap) Swap(i, j int)

type Stack

type Stack[T any] struct {
	// contains filtered or unexported fields
}

Stack 栈

func (*Stack[T]) GetContent

func (s *Stack[T]) GetContent() []T

func (*Stack[T]) Len

func (s *Stack[T]) Len() int

func (*Stack[T]) Pop

func (s *Stack[T]) Pop() T

func (*Stack[T]) Push

func (s *Stack[T]) Push(v T)

Jump to

Keyboard shortcuts

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