org.eclipse.mat.collect
Class ArrayInt

java.lang.Object
  extended by org.eclipse.mat.collect.ArrayInt

public final class ArrayInt
extends java.lang.Object

Utility class to hold a list of ints Similar to a list, but efficient for ints


Constructor Summary
ArrayInt()
          Create a list of default size
ArrayInt(ArrayInt template)
          Create a list based on an existing ArrayInt, of size of the template
ArrayInt(int initialCapacity)
          Create a list of given size
ArrayInt(int[] initialValues)
          Create a list based on a supplied array
 
Method Summary
 void add(int element)
          append one more entry
 void addAll(ArrayInt template)
          append all of another
 void addAll(int[] elements)
          append a group of entries
 void clear()
          clear all the entries
 int firstElement()
          get the first entry to be written.
 int get(int index)
          retrieve one entry
 boolean isEmpty()
          is the list empty
 IteratorInt iterator()
          get an iterator to go through the list
 int lastElement()
          get the last entry to be written.
 int set(int index, int element)
          modify one particular entry
 int size()
          get the number of used entries
 void sort()
          arrange the entries in ascending order
 int[] toArray()
          convert to an array
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayInt

public ArrayInt()
Create a list of default size


ArrayInt

public ArrayInt(int initialCapacity)
Create a list of given size

Parameters:
initialCapacity -

ArrayInt

public ArrayInt(int[] initialValues)
Create a list based on a supplied array

Parameters:
initialValues - a copy is taken of this array

ArrayInt

public ArrayInt(ArrayInt template)
Create a list based on an existing ArrayInt, of size of the template

Parameters:
template - a copy is taken of these values
Method Detail

add

public void add(int element)
append one more entry

Parameters:
element - the int to add to the end

addAll

public void addAll(int[] elements)
append a group of entries

Parameters:
elements -

addAll

public void addAll(ArrayInt template)
append all of another

Parameters:
template -

set

public int set(int index,
               int element)
modify one particular entry

Parameters:
index -
element -
Returns:
the previous value

get

public int get(int index)
retrieve one entry

Parameters:
index -
Returns:
the entry

size

public int size()
get the number of used entries

Returns:
the number of entries

toArray

public int[] toArray()
convert to an array

Returns:
a copy of the entries

isEmpty

public boolean isEmpty()
is the list empty

Returns:
true if empty

iterator

public IteratorInt iterator()
get an iterator to go through the list

Returns:
the iterator

clear

public void clear()
clear all the entries


lastElement

public int lastElement()
get the last entry to be written. Must be at least one entry.

Returns:
the last element
Since:
1.0

firstElement

public int firstElement()
get the first entry to be written. Must be at least one entry.

Returns:
the first element
Since:
1.0

sort

public void sort()
arrange the entries in ascending order