ActionCallback (final int index) { final ActionCallback result = new ActionCallback(); final Restore action = myActions.get(index); final ActionCallback actionCalback = action.restoreInGrid(); actionCalback.doWhenDone(() -> { if (index < myActions.size() - 1) { restore(index + 1).notifyWhenDone(result); } else { result.setDone(); } }); return result; }