base

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: Apache-2.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 HashSet

type HashSet[T comparable] struct {
	// contains filtered or unexported fields
}

HashSet 这是一个 set 结构 (去重)

func NewHashSet

func NewHashSet[T comparable]() *HashSet[T]

func (*HashSet[T]) Add

func (h *HashSet[T]) Add(item T)

func (*HashSet[T]) Contains

func (h *HashSet[T]) Contains(item T) bool

func (*HashSet[T]) Items

func (h *HashSet[T]) Items() []T

func (*HashSet[T]) Length

func (h *HashSet[T]) Length() int

func (*HashSet[T]) Remove

func (h *HashSet[T]) Remove(item T)

type List

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

List 这是一个 list 的包装

func NewList

func NewList[T any]() *List[T]

func (*List[T]) Add

func (l *List[T]) Add(item T)

func (*List[T]) Clear

func (l *List[T]) Clear()

func (*List[T]) Get

func (l *List[T]) Get(index int) (T, error)

func (*List[T]) Items

func (l *List[T]) Items() []T

func (*List[T]) Length

func (l *List[T]) Length() int

func (*List[T]) Remove

func (l *List[T]) Remove(index int) error

type Map

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

Map golang 的 map 是无序的 有时候其实是需要一个有序的 map 结构

func NewMap

func NewMap[K comparable, V any]() *Map[K, V]

func (*Map[K, V]) Clear

func (m *Map[K, V]) Clear()

func (*Map[K, V]) Delete

func (m *Map[K, V]) Delete(key K)

func (*Map[K, V]) Get

func (m *Map[K, V]) Get(key K) (V, bool)

func (*Map[K, V]) Keys

func (m *Map[K, V]) Keys() []K

func (*Map[K, V]) Length

func (m *Map[K, V]) Length() int

func (*Map[K, V]) Set

func (m *Map[K, V]) Set(key K, value V)

func (*Map[K, V]) Sort

func (m *Map[K, V]) Sort(compare func(a, b K) bool)

Jump to

Keyboard shortcuts

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