类 RingArray<T>

java.lang.Object
org.dromara.northstar.indicator.model.RingArray<T>

public class RingArray<T> extends Object
这是一个环型数组,能简单地实现一个滑动窗口的数据结构
  • 构造器详细资料

    • RingArray

      public RingArray(int size)
  • 方法详细资料

    • get

      public T get()
    • get

      public T get(int index)
      get(0) 是访问队头(最新的)数据 get(-1) 是访问队头第二个数据 get(1) 是访问队尾数据
      参数:
      index -
      返回:
    • update

      public Optional<T> update(T obj, boolean unstable)
      更新值
      参数:
      obj - 返回旧值
      返回:
    • toArray

      public Object[] toArray()
    • size

      public int size()
      实际大小
      返回:
    • length

      public int length()
      最大长度
      返回: