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) ======================================================================
|