public void transferMoneyBalanceCheck( AccountHolder fromData, AccountHolder toData, double amount, Consumer<Boolean> result) { new Thread( () -> { if (fromData.withdrawMoney(amount)) { toData.creditMoney(amount); if (result != null) result.accept(true); } else if (result != null) result.accept(false); }) .start(); }