Skip to content
This repository has been archived by the owner on Apr 24, 2023. It is now read-only.

gofor-little/ts

Repository files navigation

A package for common thread safe data structures

GitHub tag (latest SemVer pre-release) GitHub go.mod Go version License: MIT) GitHub Workflow Status Go Report Card PkgGoDev

Introduction

  • Currently supports linked lists and slices
  • No dependencies outside the standard library

Example

package main

import (
	"fmt"

	"github.com/gofor-little/ts"
)

func main() {
    list := ts.LinkedList{}
    list.Push("Some string")

    item := list.GetTail()
    fmt.Println(item)

    item = list.Pop()
    fmt.Println(item)

    slice := ts.Slice{}

    slice.Add(1, 2, 3)
    fmt.Println(slice.GetElements())

    slice.Remove(1, 2, 3)
    fmt.Println(slice.GetElements())
}

Testing

Run go test -v -race ./... in the root directory.