The SingletonList class is designed to implement a singleton queue.

SingletonList 类用于实现单例队列。

类型参数

  • T

层级 (查看完整内容)

构造函数

属性

elements: T[] = []

[Read-only] The array storing the elements of the queue.

[只读] 存储队列元素的数组。

length: number = 0

[Read-only] The current length of the queue.

[只读] 队列的当前长度。

方法

  • 参数

    • element: T

      The element to add.

    返回 void

    Adds an element to the list if it is not already present.

    如果元素尚未存在于列表中,则添加该元素。

  • 参数

    返回 void

    Adds all elements from another SingletonList to this list.

    将另一个 SingletonList 中的所有元素添加到此列表中。

  • 返回 void

    Trims the elements array to match the current length of the list.

    将元素数组的长度调整为与列表的当前长度相匹配。