Class PrimitiveArrayBuilder<T>

    • Field Detail

      • INITIAL_CHUNK_SIZE

        static final int INITIAL_CHUNK_SIZE
        Let's start with small chunks; typical usage is for small arrays anyway.
        See Also:
        Constant Field Values
      • SMALL_CHUNK_SIZE

        static final int SMALL_CHUNK_SIZE
        Also: let's expand by doubling up until 64k chunks (which is 16k entries for 32-bit machines)
        See Also:
        Constant Field Values
      • MAX_CHUNK_SIZE

        static final int MAX_CHUNK_SIZE
        Let's limit maximum size of chunks we use; helps avoid excessive allocation overhead for huge data sets. For now, let's limit to quarter million entries, 1 meg chunks for 32-bit machines.
        See Also:
        Constant Field Values
      • _freeBuffer

        protected T _freeBuffer
      • _bufferedEntryCount

        protected int _bufferedEntryCount
        Number of total buffered entries in this buffer, counting all instances within linked list formed by following _bufferHead.
    • Constructor Detail

      • PrimitiveArrayBuilder

        protected PrimitiveArrayBuilder()
    • Method Detail

      • bufferedSize

        public int bufferedSize()
      • resetAndStart

        public T resetAndStart()
      • appendCompletedChunk

        public final T appendCompletedChunk​(T fullChunk,
                                            int fullChunkLength)
        Returns:
        Length of the next chunk to allocate
      • completeAndClearBuffer

        public T completeAndClearBuffer​(T lastChunk,
                                        int lastChunkEntries)
      • _constructArray

        protected abstract T _constructArray​(int len)
      • _reset

        protected void _reset()