Class LongList


  • public class LongList
    extends java.lang.Object
    Represents a list of long
    Version:
    $Id: LongList.java,v 1.2 2004/08/26 12:33:16 thlee Exp $ $Name: $
    Author:
    TiongHiang Lee (thlee@onemindsoft.org)
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int _count
      the count of longs in the list *
      private long[] _list
      the list *
      private static int GROW
      the growth rate *
      private static int INITIAL_CAPACITY
      the initial capacity *
    • Constructor Summary

      Constructors 
      Constructor Description
      LongList()
      LongList​(int capacity)
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(long l)
      Add a long to the list
      void add​(long l, int i)
      Add a long at index i
      private void ensureCapacity​(int size)
      ensure the capacity of the long
      long first()
      Return the first long in the list
      long get​(int i)
      Get the long on index i in the list
      long last()
      Return the last long in the list
      long remove​(int i)
      Remove the long at index i
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • INITIAL_CAPACITY

        private static final int INITIAL_CAPACITY
        the initial capacity *
        See Also:
        Constant Field Values
      • _count

        private int _count
        the count of longs in the list *
      • _list

        private long[] _list
        the list *
    • Constructor Detail

      • LongList

        public LongList()
      • LongList

        public LongList​(int capacity)
        Parameters:
        capacity - initial capacity
    • Method Detail

      • add

        public void add​(long l)
        Add a long to the list
        Parameters:
        l - the long
      • get

        public long get​(int i)
        Get the long on index i in the list
        Parameters:
        i - the index
        Returns:
        the long
      • add

        public void add​(long l,
                        int i)
        Add a long at index i
        Parameters:
        l - the long
        i - the index
      • ensureCapacity

        private void ensureCapacity​(int size)
        ensure the capacity of the long
        Parameters:
        size - the size
      • remove

        public long remove​(int i)
        Remove the long at index i
        Parameters:
        i - the index
        Returns:
        the long at index i
      • first

        public long first()
        Return the first long in the list
        Returns:
        the first long
      • last

        public long last()
        Return the last long in the list
        Returns:
        the last long