net.rim.device.api.util
Class IntStack

java.lang.Object
  extended by net.rim.device.api.util.IntVector
      extended by net.rim.device.api.util.IntStack
All Implemented Interfaces:
Persistable

public class IntStack
extends IntVector
implements Persistable

Last-in-first-out (LIFO) stack of integer values.

Since:
BlackBerry API 3.6.0

Field Summary
 
Fields inherited from class net.rim.device.api.util.IntVector
capacityIncrement, elementCount, elementData
 
Constructor Summary
IntStack()
          Creates an empty stack.
IntStack(int initialCapacityInt)
          Allows the creation of the stack with a different initial capacity.
 
Method Summary
 int peek()
          Retrieves the int at the top of this stack without removing it.
 int pop()
          Retrieves the int at the top of the stack and removes it.
 int push(int valueInt)
          Pushes an int onto the top of this stack.
 int search(int valueInt)
          Returns the 1-based position where an object is on this stack.
 
Methods inherited from class net.rim.device.api.util.IntVector
addElement, capacity, contains, copyInto, elementAt, ensureCapacity, firstElement, getArray, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, removeAllElements, removeElement, removeElementAt, setElementAt, setSize, size, toArray, trimToSize
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Constructor Detail

IntStack

public IntStack()
Creates an empty stack.

Since:
BlackBerry API 3.6.0

IntStack

public IntStack(int initialCapacityInt)
Allows the creation of the stack with a different initial capacity.

Parameters:
initialCapacityInt - Initial capacity to use.
Since:
BlackBerry API 3.6.0


Method Detail

push

public int push(int valueInt)
Pushes an int onto the top of this stack.

Parameters:
valueInt - Value to push.
Returns:
Int value pushed.
Since:
BlackBerry API 3.6.0

pop

public int pop()
Retrieves the int at the top of the stack and removes it.

Returns:
Int value at the top of the stack.
Since:
BlackBerry API 3.6.0

peek

public int peek()
Retrieves the int at the top of this stack without removing it.

Returns:
Int value at the top of the stack.
Since:
BlackBerry API 3.6.0

search

public int search(int valueInt)
Returns the 1-based position where an object is on this stack. If the value occurs as an item in this stack, this method returns the distance from the top of the stack of the occurrence nearest the top of the stack; the topmost item on the stack is considered to be at distance 1.

Parameters:
valueInt - Value to search for.
Returns:
1-based position from the top of the stack where the value is located.
Since:
BlackBerry API 3.6.0





Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.