org.ckkloverdos.collection
Class IntArray

java.lang.Object
  extended by org.ckkloverdos.collection.IntArray
All Implemented Interfaces:
IToStringAware

public final class IntArray
extends java.lang.Object
implements IToStringAware

Fast dynamic array of int primitives.

Author:
Christos KK Loverdos

Constructor Summary
IntArray()
           
IntArray(int initialCapacity)
           
IntArray(int[] array)
           
 
Method Summary
 void add(int i)
           
 int[] array()
          Returns the underlying int array.
 void compact()
           
 void decrease(int index)
           
 void decreaseBy(int index, int value)
           
 void ensureCapacity(int length)
          Ensures that the underlying storage has at least the given length.
 int first()
           
 int get(int index)
           
 void increase(int index)
           
 void increaseBy(int index, int value)
           
 int last()
           
 int length()
           
static void main(java.lang.String[] args)
           
 int peek()
           
 int pop()
           
 void push(int i)
           
 void removeByIndex(int index)
           
 void set(int index, int value)
           
 java.lang.String toString()
           
 void toStringAware(ToString ts)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IntArray

public IntArray()

IntArray

public IntArray(int initialCapacity)

IntArray

public IntArray(int[] array)
Method Detail

add

public void add(int i)

length

public int length()

removeByIndex

public void removeByIndex(int index)

array

public int[] array()
Returns the underlying int array. Note that you need to consult length() in order to get the actual length of the array, since the underlying storage may be bigger than expected.


ensureCapacity

public void ensureCapacity(int length)
Ensures that the underlying storage has at least the given length.

Parameters:
length -

set

public void set(int index,
                int value)

increase

public void increase(int index)

decrease

public void decrease(int index)

increaseBy

public void increaseBy(int index,
                       int value)

decreaseBy

public void decreaseBy(int index,
                       int value)

get

public int get(int index)

first

public int first()

last

public int last()

push

public void push(int i)

peek

public int peek()

pop

public int pop()

compact

public void compact()

toString

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

toStringAware

public void toStringAware(ToString ts)
Specified by:
toStringAware in interface IToStringAware

main

public static void main(java.lang.String[] args)


Copyright © 1999-2007 Christos KK Loverdos. All Rights Reserved.