package

github.com/break2bits/crystal-linked-list

master / published Mar 24, 2020 / repository

Simple linked list implementation

Crystal Linked List CircleCI

A simple linked list implementation in Crystal

Installation

Add this to a project's shards.yml

dependencies:
  linked_list:
    git: https://github.com/abvdasker/crystal-linked-list.git

Then run shards

Usage

require "linked_list"

list = LinkedList(Int32 | String).new
list.append(1)
list.push(2)
list << "foo"

list.peek        # "foo"
list.pop         # "foo"
list.pop         # 2
list.unshift(1)
list.shift       # 1

API

  • LinkedList(A)

    A linked list is a Enumerable (see the Enumerable module) data structure that stores multiple pieces of data in non contiguous locations in memory.

  • LinkedListBenchmark