Remove contents of a stack

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • thatos
    New Member
    • Aug 2007
    • 105

    #1

    Remove contents of a stack

    Is the any other way to remove contents of a stack without using the following loop or is there any other way to remove stack contents?
    Here is the loop
    Code:
    Stack s = new Stack();
    .
    .
    .
    .
    .
    while (s.empty == false){
    s.pop();
    }
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Originally posted by thatos
    Is the any other way to remove contents of a stack without using the following loop or is there any other way to remove stack contents?
    Here is the loop
    Code:
    Stack s = new Stack();
    .
    .
    .
    .
    .
    while (s.empty == false){
    s.pop();
    }
    When you read the API docs for a core class such as the Stack class, also read
    the API docs of its super class. Pay attention to the clear() method.

    kind regards,

    Jos

    Comment

    • thatos
      New Member
      • Aug 2007
      • 105

      #3
      Originally posted by JosAH
      When you read the API docs for a core class such as the Stack class, also read
      the API docs of its super class. Pay attention to the clear() method.

      kind regards,

      Jos
      Thanks very much I found lots of informaiton on the API which I previously did not know.

      Comment

      • BigDaddyLH
        Recognized Expert Top Contributor
        • Dec 2007
        • 1216

        #4
        Originally posted by thatos
        Thanks very much I found lots of informaiton on the API which I previously did not know.
        You didn't know about the existence of the API before?

        Comment

        Working...