### Question:
GridTraversal implements Spliterator<double[]> { public static Stream<double[]> stream(final double[] trajectory, final int dimension, final boolean includeStart, final boolean parallel) { return new GridTraversal.Builder() .setPolyline(trajectory, dimension) .setIncludeStart(includeStart) .setParallel(parallel) .stream(); } private  GridTraversal(PointList trajectory); private  GridTraversal(final PointList trajectory, final int startPoint, final int endPoint); @Override boolean tryAdvance(Consumer<? super double[]> action); @Override Spliterator<double[]> trySplit(); @Override long estimateSize(); @Override int characteristics(); static Stream<double[]> stream(final double[] trajectory, final int dimension, final boolean includeStart, final boolean parallel);  }### Answer:
@Test public void testIncludeStart() { final GridTraversal.Builder builder = new GridTraversal.Builder() .setPolyline(2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7) .setIncludeStart(false); double[] firstPoint = getFirstPoint(builder); Assert.assertArrayEquals("Should be equal to second point", new double[]{4, 4}, firstPoint, 1e-9); builder.setIncludeStart(true); firstPoint = getFirstPoint(builder); Assert.assertArrayEquals("Should be equal to first point", new double[]{3, 3}, firstPoint, 1e-9); builder.setPolyline(2, 3, 3, 2, 2); firstPoint = getFirstPoint(builder); Assert.assertArrayEquals("Should be equal to first point", new double[]{3, 3}, firstPoint, 1e-9); builder.setIncludeStart(false); firstPoint = getFirstPoint(builder); Assert.assertArrayEquals("Should be equal to second point", new double[]{2, 2}, firstPoint, 1e-9); builder.setPolyline(1, 3, 2, 1); firstPoint = getFirstPoint(builder); Assert.assertArrayEquals("Should be equal to second point", new double[]{2}, firstPoint, 1e-9); builder.setIncludeStart(true); Assert.assertArrayEquals("Should be equal to first point", new double[]{2}, firstPoint, 1e-9); builder.setIncludeStart(false) .setPolyline(1, 1); assertFalse("No point should be returned", builder.stream().findFirst().isPresent()); }