Documentation
¶
Index ¶
- type GElement
- type GList
- func (p *GList[T]) Add(item T)
- func (p *GList[T]) AddUnique(item T)
- func (p *GList[T]) Append(item T)
- func (p *GList[T]) AppendUnique(item T)
- func (p *GList[T]) Clear()
- func (p *GList[T]) Empty() bool
- func (p *GList[T]) Front() *GElement[T]
- func (p *GList[T]) Insert(item T, pos *GElement[T])
- func (p *GList[T]) Range() iter.Seq[T]
- func (p *GList[T]) Remove(e *GElement[T])
- func (p *GList[T]) SearchAll(item T) []*GElement[T]
- func (p *GList[T]) SearchOne(item T) *GElement[T]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GElement ¶
type GElement[T comparable] struct { Data T Pre *GElement[T] Next *GElement[T] }
generics element type of GList
func (*GElement[T]) NextElement ¶
if current element is the last one, will return nil
func (*GElement[T]) PreElement ¶
if current element is the last one, will return nil
type GList ¶
type GList[T comparable] struct { // contains filtered or unexported fields }
generics list type
func NewGList ¶
func NewGList[T comparable]() *GList[T]
use it like this: listNew := NewGList[TypeName]()
func (*GList[T]) AddUnique ¶
func (p *GList[T]) AddUnique(item T)
AddUnique: insert item at front if it not exists.
func (*GList[T]) AppendUnique ¶
func (p *GList[T]) AppendUnique(item T)
AppendUnique: first search, append at the end if not found
func (*GList[T]) Range ¶
use it in for-range loop. usage:
for val := range list1.Range() {
// so some thing
}
Click to show internal directories.
Click to hide internal directories.