Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/jcarugati/generic-linked-lists

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/jcarugati/generic-linked-lists

  • v0.0.0-20220816124027-dde37021eba6
  • Source
  • Go
  • Socket score

Version published
Created
Source

Generic Linked Lists Utils

Package that offers generic linked list functionality

Quick Start

Simple linked list

package main

import (
	"fmt"
	"math/rand"
)

func Foo() {

	// Instantiate a Simple link of type int
	link := NewSimpleLink[int]()

	// Add Values to the linked list
	for i := 0; i < 10; i++ {
		num := rand.Int()
		link.Add(num)
	}

	// Iterate
	for item := link.Next(); item != nil; item = link.Next() {
		// Get value associated with node
		value := item.GetValue()
		fmt.Println(value)
	}
}

Doubly linked list

package main

import (
	"fmt"
	"math/rand"
)

func Foo() {

	// Instantiate a Simple link of type int
	link := NewDoublyLink[int]()

	// Add Values to the linked list
	for i := 0; i < 10; i++ {
		num := rand.Int()
		link.Add(num)
	}

	// Iterate to tail value
	for item := link.Next(); item != nil; item = link.Next() {
		// Get value associated with node
		value := item.GetValue()
		fmt.Println(value)
	}

	// Iterate back to head value
	for item := link.Prev(); item != nil; item = link.Prev() {
		// Get value associated with node
		value := item.GetValue()
		fmt.Println(value)
	}
}

FAQs

Package last updated on 16 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc