Class BigList.Block<T>

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<T>, java.util.Collection<T>, java.util.List<T>, java.util.RandomAccess, ICollection<T>, IListable<T>
    Enclosing class:
    BigList<E>

    static class BigList.Block<T>
    extends GapList<T>
    A block stores in maximum blockSize number of elements. The first block in a BigList 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 BigList instances with a copy-on-write approach.
    • Field Detail

      • refCount

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

      • Block

        public Block()
      • Block

        public Block​(int capacity)
    • Method Detail

      • isShared

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

        public BigList.Block<T> ref()
        Increment reference count as block is used by one BigList instance more.
      • unref

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