com.sun.kjava
Class List

java.lang.Object
  |
  +--com.sun.kjava.List

public class List
extends java.lang.Object

A class representing a list of Objects. Resembles java.util.Vector.


Constructor Summary
List()
          Create a new List, and make it small to start.
List(int initSize)
          Create a new List.
 
Method Summary
 void append(java.lang.Object obj)
          Append an Object to the end, expanding the vector if necessary.
 int capacity()
          /** What is the total capacity of this List?
 java.lang.Object elementAt(int i)
          What is the Object at a given index? N.B.
 void ensureCapacity(int newCap)
          Ensure there's room for some number of entries by any means necessary.
 void removeAllElements()
          Mark the vector as containing no Objects, and drop all references to the Objects previously contained.
 boolean setElementAt(java.lang.Object o, int pos)
          Set the indexed element to an Object.
 int size()
          What is the size of this List?
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

List

public List()
Create a new List, and make it small to start.

List

public List(int initSize)
Create a new List.
Parameters:
initSize - the number of initial elements to allocate
Method Detail

elementAt

public java.lang.Object elementAt(int i)
What is the Object at a given index? N.B. This does no bounds checking.
Parameters:
i - the index of the entry
Returns:
the Object at that index.

size

public int size()
What is the size of this List?
Returns:
the number of Objects stored

append

public void append(java.lang.Object obj)
Append an Object to the end, expanding the vector if necessary.
Parameters:
i - the value of the new datum

removeAllElements

public void removeAllElements()
Mark the vector as containing no Objects, and drop all references to the Objects previously contained.

capacity

public int capacity()
/** What is the total capacity of this List?
Returns:
the number of entries currently allocated space, not all of which may be occupied.
See Also:
size()

ensureCapacity

public void ensureCapacity(int newCap)
Ensure there's room for some number of entries by any means necessary.
Parameters:
newCap - the desired new capacity

setElementAt

public boolean setElementAt(java.lang.Object o,
                            int pos)
Set the indexed element to an Object.

Note: this is a replacement operation - it is not an insertion into the list!

Parameters:
o - the Object to place in the List
pos - the index at which to place it.