helpers.lists.LimitedList - ZeMA-gGmbH/NoPE-JS GitHub Wiki
Limited List. This list at max contains a specific amount of elements. After the max number of elements has been added, the first element added will be removed.
| Name |
|---|
T |
new LimitedList<T>(maxLength)
| Name |
|---|
T |
| Name | Type |
|---|---|
maxLength |
number |
maxLength: number
get currentPointer(): number
Gets the current pointer.
Memberof
LimitedList
number
get length(): number
Contains the Length of the list.
Memberof
LimitedList
number
current(): T
Returns the current item, the pointer is showing at.
T
first(): T
Returns the Pointer to the first item.
T
forEach(callbackFn, thisArg?): void
Helper to iterate over all items.
| Name | Type |
|---|---|
callbackFn |
(item: T, index: number, array: T[]) => void
|
thisArg? |
any |
void
last(): T
T
next(): T
T
pop(current?): T
Pops the last element. If there is no element undefined is returned.
| Name | Type | Default value |
|---|---|---|
current |
boolean |
false |
T
The last element.
previous(): T
Returns the last item. Adapts the pointer and the current item is the last item. example: l = limited.last() c = limited.current()
l == c -> True
T
The last element.
push(data): number
Adds Data to the Stack. The Pointer is getting adapted.
Memberof
LimitedList
| Name | Type |
|---|---|
data |
T |
number