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

github.com/dienakakim/linkedlist

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/dienakakim/linkedlist

  • v0.0.0-20201102001215-4b8a2e27e0ab
  • Source
  • Go
  • Socket score

Version published
Created
Source

LinkedList

Description

This project contains code implementing a generic doubly linked list in Go. Takes a placeholder element to use as the list's key type, and requires all argument keys to have that type.

Exposed methods

func NewLinkedList(key interface{}) LinkedList

NewLinkedList is a factory function creating a new LinkedList with a given element as its keyType.

func (l *LinkedList) InsertBack(key interface{}) (bool, error)
func (l *LinkedList) InsertFront(key interface{}) (bool, error)
func (l *LinkedList) InsertAt(index uint, key interface{}) (bool, error)

Insert methods -- InsertBack inserts at the end of the list, InsertFront inserts at the front, and InsertAt inserts at a given index.

func (l *LinkedList) At(index uint) (interface{}, error)

Retrieves an element at the given index.

func (l *LinkedList) IndexOf(t interface{}) (uint, error)

Finds a given element and returns its index if it is in the list.

func (l *LinkedList) String() string

Returns the list's string representation.

func (l *LinkedList) RemoveBack() (interface{}, error)
func (l *LinkedList) RemoveFront() (interface{}, error)
func (l *LinkedList) RemoveAt(index uint) (interface{}, error)

Remove methods -- same semantics as detailed in insert methods.

func (l *LinkedList) Remove(key interface{}) (bool, error)

Removes a given element from the list if found.

FAQs

Package last updated on 02 Nov 2020

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