org.ckkloverdos.collection
Class IntArray
java.lang.Object
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
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
IntArray
public IntArray()
IntArray
public IntArray(int initialCapacity)
IntArray
public IntArray(int[] array)
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.