Options
All
  • Public
  • Public/Protected
  • All
Menu

Class LinkedListStatic

Holds the "static methods" for LinkedList

Hierarchy

  • LinkedListStatic

Index

Methods

empty

isEmpty

isNotEmpty

of

ofIterable

  • Build a stream from any iterable, which means also an array for instance.

    Type parameters

    • T

      the item type

    Parameters

    • elts: Iterable<T>

    Returns LinkedList<T>

unfoldRight

  • unfoldRight<T, U>(seed: T, fn: function): LinkedList<U>
  • Dual to the foldRight function. Build a collection from a seed. Takes a starting element and a function. It applies the function on the starting element; if the function returns None, it stops building the list, if it returns Some of a pair, it adds the first element to the result and takes the second element as a seed to keep going.

    LinkedList.unfoldRight(
         10, x=>Option.of(x)
             .filter(x => x!==0)
             .map<[number,number]>(x => [x,x-1]))
    => LinkedList.of(10, 9, 8, 7, 6, 5, 4, 3, 2, 1)
    

    Type parameters

    • T

    • U

    Parameters

    • seed: T
    • fn: function
        • Parameters

          • x: T

          Returns Option<[U, T]>

    Returns LinkedList<U>

Generated using TypeDoc