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

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

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Won't Fix
    • P4
    • None
    • 1.3.1
    • core-libs

    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

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

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: