Class IntList.Array

  • Enclosing class:
    IntList

    public static class IntList.Array
    extends IntList
    An implementation of an IntList that is mutable and backed by an array
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.biomatters.geneious.publicapi.utilities.IntList

        IntList.Array
    • Constructor Summary

      Constructors 
      Constructor Description
      Array​(int initialCapacity)
      Construct a new empty IntList with the given intial capacity
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(int value)
      Adds a new element to the end of the list
      void addAll​(IntList values)
      Adds all values from another IntList to this IntList
      void compact()
      Compacts the underlying storage array to only big as big as it needs to be to hold the current data.
      int get​(int index)
      Gets the value at this index.
      boolean isEmpty()
      Returns true if this list is empty IntList.size()==0)
      int set​(int index, int newValue)
      sets the value of the list at the given index
      int size()
      Returns the size of this list like List.size()
      void sort()
      sorts the values in this list in increasing order
      IntList subList​(int minIndex, int maxIndexExclusive)
      Creates a sub list
      int[] toIntArray()  
      int[] toIntArray​(int minIndex, int maxIndexExclusive)
      returns a copy of a sub-list of the elements in this list as an array
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Array

        public Array​(int initialCapacity)
        Construct a new empty IntList with the given intial capacity
        Parameters:
        initialCapacity - the initial capacity of the internal array
    • Method Detail

      • get

        public int get​(int index)
        Description copied from class: IntList
        Gets the value at this index. (like List.get(int)
        Specified by:
        get in class IntList
        Parameters:
        index - the 0-based index of the element to get
        Returns:
        the value at this index
      • set

        public int set​(int index,
                       int newValue)
        sets the value of the list at the given index
        Parameters:
        index - the index in the range 0->size()-1
        newValue - the new value
        Returns:
        the previous value at this index
      • add

        public void add​(int value)
        Adds a new element to the end of the list
        Parameters:
        value - the new value to add
      • size

        public int size()
        Description copied from class: IntList
        Returns the size of this list like List.size()
        Specified by:
        size in class IntList
        Returns:
        the size of this list
      • compact

        public void compact()
        Compacts the underlying storage array to only big as big as it needs to be to hold the current data.
      • toIntArray

        public int[] toIntArray()
        Overrides:
        toIntArray in class IntList
        Returns:
        a copy of the elements in this list as an array
      • toIntArray

        public int[] toIntArray​(int minIndex,
                                int maxIndexExclusive)
        returns a copy of a sub-list of the elements in this list as an array
        Parameters:
        minIndex - the first index for the sublist
        maxIndexExclusive - the last index (exclusive) for the sublist
        Returns:
        a new array
      • sort

        public void sort()
        sorts the values in this list in increasing order
      • subList

        public IntList subList​(int minIndex,
                               int maxIndexExclusive)
        Description copied from class: IntList
        Creates a sub list
        Overrides:
        subList in class IntList
        Parameters:
        minIndex - the first index to include in the sub list
        maxIndexExclusive - the last index (exclusive) to include in the sub list
        Returns:
        a sub list
      • addAll

        public void addAll​(IntList values)
        Adds all values from another IntList to this IntList
        Parameters:
        values - the values to add
        Since:
        API 4.1110 (Geneious 11.1.0)