@Test public void shouldIterateOverArrayAndResetAgain() throws NoSuchMethodException { final long length = 11; final PointArray array = PointArray.newInstance(length); initValues(new long[] {length}, array); int i = 0; final PointArray.ElementIterator iter = array.iterator(); while (iter.hasNext()) { final long index = iter.getCursor(); final Point point = iter.next(); Assert.assertThat(valueOf(point.getX()), CoreMatchers.is(valueOf(index))); Assert.assertThat(valueOf(point.getY()), CoreMatchers.is(valueOf(index * 2))); i++; } iter.reset(); i = 0; while (iter.hasNext()) { final long index = iter.getCursor(); final Point point = iter.next(); Assert.assertThat(valueOf(point.getX()), CoreMatchers.is(valueOf(index))); Assert.assertThat(valueOf(point.getY()), CoreMatchers.is(valueOf(index * 2))); i++; } Assert.assertThat(valueOf(i), CoreMatchers.is(valueOf(length))); }
public static PointArray newInstance(final long length) { return StructuredArray.newInstance(PointArray.class, Point.class, length); }
PointArray extends StructuredArray<Point> { public static PointArray newInstance(final long length) { return StructuredArray.newInstance(PointArray.class, Point.class, length); } }
PointArray extends StructuredArray<Point> { public static PointArray newInstance(final long length) { return StructuredArray.newInstance(PointArray.class, Point.class, length); } PointArray(PointArray source);  PointArray(); }
PointArray extends StructuredArray<Point> { public static PointArray newInstance(final long length) { return StructuredArray.newInstance(PointArray.class, Point.class, length); } PointArray(PointArray source);  PointArray(); static PointArray newInstance(final long length); static PointArray newInstance(final long length,
                                           final CtorAndArgsProvider<Point> ctorAndArgsProvider); static PointArray newInstance(final long length, final long x, final long y); }
PointArray extends StructuredArray<Point> { public static PointArray newInstance(final long length) { return StructuredArray.newInstance(PointArray.class, Point.class, length); } PointArray(PointArray source);  PointArray(); static PointArray newInstance(final long length); static PointArray newInstance(final long length,
                                           final CtorAndArgsProvider<Point> ctorAndArgsProvider); static PointArray newInstance(final long length, final long x, final long y);  }