--- jsr166/src/test/loops/MapCheck.java 2005/05/02 19:19:38 1.1 +++ jsr166/src/test/loops/MapCheck.java 2005/09/15 16:55:40 1.3 @@ -1,3 +1,8 @@ +/* + * Written by Doug Lea with assistance from members of JCP JSR-166 + * Expert Group and released to the public domain, as explained at + * http://creativecommons.org/licenses/publicdomain + */ /** * @test * @synopsis Times and checks basic map operations @@ -225,12 +230,19 @@ public class MapCheck { } static void ittest3(Map s, int size) { int sum = 0; + int hsum = 0; timer.start("Iter Entry ", size); for (Iterator it = s.entrySet().iterator(); it.hasNext(); ) { - if(it.next() != MISSING) + Map.Entry e = (Map.Entry)it.next(); + if(e != MISSING) { + hsum += System.identityHashCode(e.getKey()); + hsum += System.identityHashCode(e.getValue()); + hsum >>>= 1; ++sum; + } } timer.finish(); + reallyAssert(size == 0 || hsum >= 0); reallyAssert (sum == size); }