Недоступное утверждение на Android Studio?

Я получил это недостижимое заявление в студии Andoid, я пытаюсь исправить структуру данных, но ничего не произошло, кто-нибудь может мне помочь? Проблема на

this.income += ((Income) this.li.get(i)).getJumlah();

это мой код

public static int uang;
private Button btnDeveloper;
private Button btnExit;
private Button btnIncome;
private Button btnOutcome;
private Button btnPassword;
private Button btnReport;
private Dialog dialog;
private IncomeDataSource iDS;
private int income;
private Intent intent;
private ArrayList<Income> li = new ArrayList();
private ArrayList<Outcome> lo = new ArrayList();
private MoneyDataSource mDS;
private Money money;
private OutcomeDataSource oDS;
private int outcome;
private String tuang = "";
private TextView txtUang;


public void bindingList()
{
    this.li = getAllIncome();
    this.income = 0;
    int i = 0;
    if (i >= this.li.size())
    {
        this.lo = getAllOutcome();
        this.outcome = 0;
    }
    for (int j = 0; ; j++)
    {
        if (j >= this.lo.size())
        {
            return;
            this.income += ((Income) this.li.get(i)).getJumlah();
            i++;
            break;
        }
        this.outcome += ((Outcome)this.lo.get(j)).getJumlah();
    }
}

1 ответ

Просто удалите возврат из цикла if:)

public void bindingList()
{
    this.li = getAllIncome();
    this.income = 0;
    int i = 0;
    if (i >= this.li.size())
    {
        this.lo = getAllOutcome();
        this.outcome = 0;
    }
    for (int j = 0; ; j++)
    {
        if (j >= this.lo.size())
        {

            this.income += ((Income) this.li.get(i)).getJumlah();
            i++;
            break;
        }
        this.outcome += ((Outcome)this.lo.get(j)).getJumlah();
    }
}
Другие вопросы по тегам