Package org.h2.util

Class IntArray


  • public class IntArray
    extends java.lang.Object
    An array with integer element.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int[] data  
      private int hash  
      private int size  
    • Constructor Summary

      Constructors 
      Constructor Description
      IntArray()
      Create an int array with the default initial capacity.
      IntArray​(int capacity)
      Create an int array with specified initial capacity.
      IntArray​(int[] data)
      Create an int array with the given values and size.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(int value)
      Append a value.
      void ensureCapacity​(int minCapacity)
      Ensure the underlying array is large enough for the given number of entries.
      boolean equals​(java.lang.Object obj)  
      int get​(int index)
      Get the value at the given index.
      int hashCode()  
      void remove​(int index)
      Remove the value at the given index.
      void removeRange​(int fromIndex, int toIndex)
      Remove a number of elements.
      int size()
      Get the size of the list.
      void toArray​(int[] array)
      Convert this list to an array.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • data

        private int[] data
      • size

        private int size
      • hash

        private int hash
    • Constructor Detail

      • IntArray

        public IntArray()
        Create an int array with the default initial capacity.
      • IntArray

        public IntArray​(int capacity)
        Create an int array with specified initial capacity.
        Parameters:
        capacity - the initial capacity
      • IntArray

        public IntArray​(int[] data)
        Create an int array with the given values and size.
        Parameters:
        data - the int array
    • Method Detail

      • add

        public void add​(int value)
        Append a value.
        Parameters:
        value - the value to append
      • get

        public int get​(int index)
        Get the value at the given index.
        Parameters:
        index - the index
        Returns:
        the value
      • remove

        public void remove​(int index)
        Remove the value at the given index.
        Parameters:
        index - the index
      • ensureCapacity

        public void ensureCapacity​(int minCapacity)
        Ensure the underlying array is large enough for the given number of entries.
        Parameters:
        minCapacity - the minimum capacity
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • size

        public int size()
        Get the size of the list.
        Returns:
        the size
      • toArray

        public void toArray​(int[] array)
        Convert this list to an array. The target array must be big enough.
        Parameters:
        array - the target array
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • removeRange

        public void removeRange​(int fromIndex,
                                int toIndex)
        Remove a number of elements.
        Parameters:
        fromIndex - the index of the first item to remove
        toIndex - upper bound (exclusive)