Interpolator { public Column<T> backfill() { Column<T> result = col.copy(); T lastVal = null; for (int i = col.size() - 1; i >= 0; 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 testBackfill() { DoubleColumn col = (DoubleColumn) DoubleColumn.create( "testCol", new double[] {missing, missing, 0.181, 0.186, missing, 0.181, missing}) .interpolate() .backfill(); assertArrayEquals( new double[] {0.181, 0.181, 0.181, 0.186, 0.181, 0.181, missing}, col.asDoubleArray()); }