Class BufferInteger

  • All Implemented Interfaces:
    CollectionInteger, CollectionNumber, ListNumber

    public class BufferInteger
    extends ListInteger
    An implementation of a list on top of buffer. The buffer will start at the initial capacity (default 10) and will continue to grow.
    Author:
    carcassi
    • Constructor Detail

      • BufferInteger

        public BufferInteger()
        Creates a new buffer.
      • BufferInteger

        public BufferInteger​(int initialCapacity)
        Creates a new buffer.
        Parameters:
        initialCapacity - initial capacity
    • Method Detail

      • getInt

        public int getInt​(int index)
        Returns the element at the specified position in this list casted to an int.
        Parameters:
        index - position of the element to return
        Returns:
        the element at the specified position in this list
      • size

        public int size()
        Returns the number of elements in the collection.
        Returns:
        the number of elements in the collection
      • addInt

        public void addInt​(int value)
        Adds a new value.
        Parameters:
        value - new value
      • clear

        public void clear()
        Removes all values from the buffer.
      • getCurrentCapacity

        public int getCurrentCapacity()
        The maximum capacity for this buffer.
        Returns:
        maximum capacity