Interface Tiny


public interface Tiny

An interface for the Tiny collection.

Since:
JDK1.2

Method Summary
 void add(java.lang.Object obj)
          Adds an item to the collection.
 java.lang.Object elementAt(int index)
          Returns the item at the specified index.
 boolean isEmpty()
          Checks whether the collection is empty.
 java.lang.Object removeLast()
          Removes the last item from the collection.
 int size()
          Returns the number of items in the collection.
 

Method Detail

add

public void add(java.lang.Object obj)
Adds an item to the collection. There is no check for the collection being full, so your implementation must dynamically grow the collection as necessary.

Parameters:
obj - - the item to add

isEmpty

public boolean isEmpty()
Checks whether the collection is empty.

Returns:
true if empty, false otherwise

removeLast

public java.lang.Object removeLast()
                            throws java.lang.IllegalStateException
Removes the last item from the collection.

Returns:
the last item in the collection
Throws:
java.lang.IllegalStateException - if the collection is empty

size

public int size()
Returns the number of items in the collection.

Returns:
the number of items in the collection

elementAt

public java.lang.Object elementAt(int index)
                           throws java.lang.ArrayIndexOutOfBoundsException
Returns the item at the specified index.

Parameters:
index - - an index into this collection (first = 0)
Returns:
the item at the specified index
Throws:
java.lang.ArrayIndexOutOfBoundsException - - if the index is negative or not less than the current size of this collection