}
}
public void testSparseIterator() throws Exception {
RealVector v = new TestVectorImpl(vec2.clone());
Entry e;
int i = 0;
double[] nonDefaultV2 = { -3d, 2d, 1d };
for(Iterator<Entry> it = v.sparseIterator(); it.hasNext() && (e = it.next()) != null; i++) {
assertEquals(nonDefaultV2[i], e.getValue());
}
double [] onlyOne = {0d, 1.0, 0d};
v = new TestVectorImpl(onlyOne);
for(Iterator<Entry> it = v.sparseIterator(); it.hasNext() && (e = it.next()) != null; ) {
assertEquals(onlyOne[1], e.getValue());
}
}