Class LongBigList.LongBlock

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, ILongListable
    Enclosing class:
    LongBigList

    static class LongBigList.LongBlock
    extends LongGapList
    A block stores in maximum blockSize number of elements. The first block in a LongBigList will grow until reaches this limit, all other blocks are directly allocated with a capacity of blockSize. A block maintains a reference count which allows a block to be shared among different LongBigList instances with a copy-on-write approach.
    • Field Detail

      • refCount

        private java.util.concurrent.atomic.AtomicInteger refCount
    • Constructor Detail

      • LongBlock

        public LongBlock()
      • LongBlock

        public LongBlock​(int capacity)
    • Method Detail

      • isShared

        public boolean isShared()
        Returns:
        true if block is shared by several LongBigList instances
      • ref

        public LongBigList.LongBlock ref()
        Increment reference count as block is used by one LongBigList instance more.
      • unref

        public void unref()
        Decrement reference count as block is no longer used by one LongBigList instance.