peek


Description:

public T peek ()

Returns the element at the top of the stack without removing it. Returns null if the stack is empty.

Example:

    var stack = new Stack<string> ();
stack.push ("a");
assert (stack.peek () == "a");
assert (stack.size () == 1);

Returns:

the top element, or null if empty.