Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collection ¶
type Collection[T comparable] struct { Elements map[T]EmptyType }
func NewCollection ¶
func NewCollection[T comparable]() *Collection[T]
Example ¶
fmt.Println(NewCollection[int]())
Output: &{map[]}
func (*Collection[T]) Contains ¶
func (c *Collection[T]) Contains(element T) bool
Example ¶
collection := NewCollection[int]() fmt.Println(collection.Contains(1))
Output: false
func (*Collection[T]) Size ¶
func (c *Collection[T]) Size() int
Example ¶
collection := NewCollection[int]() fmt.Println(collection.Size())
Output: 0
func (*Collection[T]) Slice ¶
func (c *Collection[T]) Slice() []T
Example ¶
collection := NewCollection[int]() fmt.Println(collection.Slice())
Output: []
type Container ¶
type Container[T comparable] interface { Contains(element T) bool }
Click to show internal directories.
Click to hide internal directories.