public void testIteratorSet() throws CloneNotSupportedException { Vector clone = test.clone(); Iterator<Vector.Element> it = clone.iterateNonZero(); while (it.hasNext()) { Vector.Element e = it.next(); e.set(e.get() * 2.0); } it = clone.iterateNonZero(); while (it.hasNext()) { Vector.Element e = it.next(); assertEquals(test.get(e.index()) * 2.0, e.get()); } clone = test.clone(); it = clone.iterator(); while (it.hasNext()) { Vector.Element e = it.next(); e.set(e.get() * 2.0); } it = clone.iterator(); while (it.hasNext()) { Vector.Element e = it.next(); assertEquals(test.get(e.index()) * 2.0, e.get()); } }