utils

package
v0.0.0-...-5bf989b Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BiggestMap

func BiggestMap(m map[*interface{}]int) (interface{}, int)

func BiggestValue

func BiggestValue(numbers []int) int

func DefaultValuedSlice

func DefaultValuedSlice[T comparable](size int, val T) []T

func GenericIntersection

func GenericIntersection[T comparable](a []T, b []T) []T

func NumberInRange

func NumberInRange(lower, upper, number int) bool

Determines if number is in supplied range (inclusive)

func OrderedStringIntersection

func OrderedStringIntersection(s1, s2 string) string

func ReadFileLineByLine

func ReadFileLineByLine(path string) []string

func ReadFileToString

func ReadFileToString(path string) string

func SmallestValue

func SmallestValue(numbers []int) int

func SplitToChunks

func SplitToChunks[T comparable](arr []T, chunkSize int) [][]T

func SumOfArray

func SumOfArray(arr []int) (sum int)

func UnOrderedStringIntersection

func UnOrderedStringIntersection(s ...string) string

func WriteFile

func WriteFile(filename string, contents []byte)

Types

type Pair

type Pair struct {
	Key   *interface{}
	Value int
}

type PairList

type PairList []Pair

func (PairList) Len

func (p PairList) Len() int

func (PairList) Less

func (p PairList) Less(i, j int) bool

func (PairList) Swap

func (p PairList) Swap(i, j int)

type Set

type Set[T comparable] map[T]interface{}

func NewSet

func NewSet[T comparable](val ...T) (s Set[T])

func (Set[T]) Add

func (s Set[T]) Add(i T)

func (Set[T]) AddListOfItems

func (s Set[T]) AddListOfItems(i []T)

func (Set[T]) Contains

func (s Set[T]) Contains(i T) bool

func (Set[T]) Len

func (s Set[T]) Len() (len int)

func (Set[T]) Remove

func (s Set[T]) Remove(i T)

type Stack

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

func NewStack

func NewStack[T any](item ...T) *Stack[T]

func (*Stack[T]) IsEmpty

func (s *Stack[T]) IsEmpty() bool

func (*Stack[T]) Length

func (s *Stack[T]) Length() int

func (*Stack[T]) Peek

func (s *Stack[T]) Peek() (item T)

func (*Stack[T]) Pop

func (s *Stack[T]) Pop() (item T)

func (*Stack[T]) Push

func (s *Stack[T]) Push(item T)

Jump to

Keyboard shortcuts

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