package
Version:
v2.1.0
Opens a new window with list of versions in this module.
Published: Dec 11, 2025
License: Apache-2.0
Opens a new window with license information.
Imports: 0
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
type Stack[T any] struct {
}
Stack 是一个通用类型的栈结构
func (s *Stack[T]) Peek() *T
Peek 返回栈顶元素但不移除,如果栈为空则返回错误
func (s *Stack[T]) Pop() *T
Pop 弹出并返回栈顶元素,如果栈为空则返回错误
func (s *Stack[T]) Push(item *T)
Push 将元素压入栈顶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.