Stack

Skip to end of metadata
Go to start of metadata

Stack

A simple stack abstraction, backed by linked list.

Stack type

stack<Type>

Subtypes Supertypes Comparable types
deque<Type> sequence<Type> java.util.Deque<Type>

Stack creation

new linkedlist

Parameter type Result type
Type...
sequence<? extends Type>
stack<Type>

Creates an empty stack. Optionally, initial values may be specified right in the new linked list creation expression.


Alternatively, a sequence may be specified that is used to copy elements from.

Operations on stack

iterator
Operand type Parameter type Result type
sequence<Type> none modifying_iterator<Type>

This operation is redefined for stack to return a modifying_iterator.

addFirst / push
Operand type Parameter type Result type
stack<Type> Type Type

Appends an element to the head of the stack.

removeFirst / pop
Operand type Parameter type Result type
stack<Type>   Type

Removes an element from the head of the stack.

first / peek
Operand type Parameter type Result type
stack<Type>   Type

Retrieves the first element at the head of the stack without removing it.

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Aug 09, 2011

    Anonymous

    tasklist: Task lists can not be used in comments.

    tasklist: Task lists can not be used in comments.
Add Comment