Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4475301

RFE: java.util.Stack.iterator() iterates the wrong way

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P4
    • Resolution: Won't Fix
    • Affects Version/s: 1.3.1
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description



      Name: bsC130419 Date: 06/27/2001


      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0)
      Classic VM (build 1.3.0, J2RE 1.3.0 IBM build cx130-20001025 (JIT enabled: jitc))


      The iterator method on java.util.Stack iterates through a Stack from the bottom
      up. One would think that it should iterate as if it were popping off the top of
      the Stack.

      % cat test.java
      import java.util.*;

      class test {
          public static void main(String[] strs) {
              Stack s = new Stack();
              s.add("one");
              s.add("two");
              s.add("three");
              s.add("four");
              System.err.println(s);
              Iterator i = s.iterator();
              while(i.hasNext()) {
                  System.err.println(i.next());
              }
          }
      }
      cindercone% javac test.java
      cindercone% java test
      [one, two, three, four]
      one
      two
      three
      four
      %

      (Review ID: 127479)
      ======================================================================

        Attachments

          Activity

            People

            • Assignee:
              mmcclosksunw Michael Mccloskey (Inactive)
              Reporter:
              bstrathesunw Bill Strathearn (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: