base

package
v0.0.0-...-ed41e97 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2023 License: MIT Imports: 0 Imported by: 0

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
}

type EmptyType

type EmptyType struct{}

type Slicer

type Slicer[T any] interface {
	Size() int
	Slice() []T
}

Jump to

Keyboard shortcuts

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