CollAggregation { @UserAggregationFunction("apoc.agg.last") @Description("apoc.agg.last(value) - returns last value") public LastFunction last() { return new LastFunction(); }  @UserAggregationFunction("apoc.agg.nth") @Description("apoc.agg.nth(value,offset) - returns value of nth row (or -1 for last)") NthFunction nthFunction(); @UserAggregationFunction("apoc.agg.first") @Description("apoc.agg.first(value) - returns first value") FirstFunction first(); @UserAggregationFunction("apoc.agg.last") @Description("apoc.agg.last(value) - returns last value") LastFunction last(); @UserAggregationFunction("apoc.agg.slice") @Description("apoc.agg.slice(value, start, length) - returns subset of non-null values, start is 0 based and length can be -1") SliceFunction slice();  }
@Test public void testLast() throws Exception { testCall(db, "UNWIND RANGE(0,10) as value RETURN apoc.agg.last(value) as last", (row) -> { assertEquals(10L, row.get("last")); }); testCall(db, "UNWIND [null,41,null,42,null] as value RETURN apoc.agg.last(value) as last", (row) -> { assertEquals(42L, row.get("last")); }); }