@Test
public void testIterator() throws Exception {

  VectorView view = new VectorView(new DenseVector(values), OFFSET, CARDINALITY);
  double[] gold = {1.1, 2.2, 3.3};
  Iterator<Vector.Element> iter = view.iterator();
  checkIterator(iter, gold);
  iter = view.iterateNonZero();
  checkIterator(iter, gold);
  view = new VectorView(new DenseVector(values), 0, CARDINALITY);
  gold = new double[]{0.0, 1.1, 2.2};
  iter = view.iterator();
  checkIterator(iter, gold);
  gold = new double[]{1.1, 2.2};
  iter = view.iterateNonZero();
  checkIterator(iter, gold);
}