VectorView extends AbstractVector { @Override public Iterator<Element> iterator() { return new AllIterator(); } VectorView();  VectorView(Vector vector, int offset, int cardinality); @Override Vector clone(); @Override boolean isDense(); @Override boolean isSequentialAccess(); @Override VectorView like(); @Override Vector like(int cardinality); @Override double getQuick(int index); @Override void setQuick(int index, double value); @Override int getNumNondefaultElements(); @Override Vector viewPart(int offset, int length); @Override Iterator<Element> iterateNonZero(); @Override Iterator<Element> iterator(); @Override double getLengthSquared(); @Override double getDistanceSquared(Vector v); @Override double getLookupCost(); @Override double getIteratorAdvanceCost(); @Override boolean isAddConstantTime(); @Override void mergeUpdates(OrderedIntDoubleMapping updates);  }
@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); }