The empty stream
Curried type guard for LinkedList. Sometimes needed also due to https://github.com/Microsoft/TypeScript/issues/20218
Vector.of(LinkedList.of(1), LinkedList.empty<number>())
.filter(LinkedList.isEmpty)
=> Vector.of(LinkedList.empty<number>())
Curried type guard for LinkedList. Sometimes needed also due to https://github.com/Microsoft/TypeScript/issues/20218
Vector.of(Stream.of(1), Stream.empty<number>())
.filter(Stream.isNotEmpty)
.map(s => s.head().get()+1)
=> Vector.of(2)
Create a LinkedList with the elements you give.
Build a stream from any iterable, which means also an array for instance.
the item type
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)
Generated using TypeDoc
Holds the "static methods" for LinkedList