jmce - 1_02

jmce.util
Class FastArray<E>

java.lang.Object
  extended by jmce.util.FastArray<E>
Direct Known Subclasses:
Stack, TapeData

public class FastArray<E>
extends java.lang.Object

A class like standard java.util.ArrayList but without implementation of list and synchronization for maximum performance.

Version:
1.02
Author:
Mario Viara

Constructor Summary
FastArray()
          Default constructor.
FastArray(int n)
          Constructor with the initial capacity specified and a default growing size of 10.
FastArray(int initialCapacity, int growSize)
          Constructor with initial capacity of the array and growing size.
 
Method Summary
 void add(E o)
          Add a new element to the end of the array
 void add(int i, java.lang.Object o)
          Insert a new element at the specified position.
 void clear()
          Clear the array element
 boolean contains(java.lang.Object o)
          Return true if the array contains the specified object.
 E get(int i)
          Return the element at the specified position
 int getGrowSize()
          Return the grow size.
 int getSize()
          Return the size of the array.
 int indexOf(java.lang.Object o)
          Return the index of the specified element or -1 if the element is not present in the array.
 void remove(int i)
          Remove one element from the arrag.
 void remove(java.lang.Object o)
          Remove the specified object from the array.
 void setGrowSize(int n)
          Set the grow size.
 int size()
          Deprecated. Use getSize() method.
 E[] toArray(E[] a)
          Return an array with all elements.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FastArray

public FastArray(int initialCapacity,
                 int growSize)
Constructor with initial capacity of the array and growing size.

Parameters:
initialCapacity - - Initial capacity of the array.
growSize - - When the array is full it will be grow of growSize element. If the growing size is 0 the array will double it's capacity.

FastArray

public FastArray(int n)
Constructor with the initial capacity specified and a default growing size of 10.


FastArray

public FastArray()
Default constructor.

Method Detail

setGrowSize

public final void setGrowSize(int n)
Set the grow size. If 0 when the array must be expanded the size will be doubled.


getGrowSize

public final int getGrowSize()
Return the grow size.


size

@Deprecated
public final int size()
Deprecated. Use getSize() method.

Return the size of the array.


getSize

public final int getSize()
Return the size of the array.

Since:
1.01

clear

public final void clear()
Clear the array element


add

public final void add(E o)
Add a new element to the end of the array


add

public final void add(int i,
                      java.lang.Object o)
Insert a new element at the specified position.


indexOf

public final int indexOf(java.lang.Object o)
Return the index of the specified element or -1 if the element is not present in the array.


remove

public final void remove(int i)
Remove one element from the arrag.


remove

public final void remove(java.lang.Object o)
Remove the specified object from the array.


get

public final E get(int i)
Return the element at the specified position


contains

public final boolean contains(java.lang.Object o)
Return true if the array contains the specified object.


toArray

public final E[] toArray(E[] a)
Return an array with all elements.

Since:
1.02

jmce - 1_02