Interpolator { public Column<T> frontfill() { Column<T> result = col.copy(); T lastVal = null; for (int i = 0; i < col.size(); i++) { if (col.isMissing(i)) { if (lastVal != null) { result.set(i, lastVal); } } else { lastVal = col.get(i); } } return result; } Interpolator(Column<T> column); Column<T> backfill(); Column<T> frontfill();  }
@Test public void testFrontfill() { DoubleColumn col = (DoubleColumn) DoubleColumn.create( "testCol", new double[] {missing, missing, 0.181, 0.186, missing, missing, 0.181}) .interpolate() .frontfill(); assertArrayEquals( new double[] {missing, missing, 0.181, 0.186, 0.186, 0.186, 0.181}, col.asDoubleArray()); }