I'm going through an array and trying to get an index of an object meeting some criteria. I can't figure out a way to do that.
I've tried using herniPlan.indexOf(m), I'm getting "Cannot find symbol - method indexOf(hra.Mince)
public class MojeHra implements IHra {
private Mince[] herniPlan;
int index;
public MojeHra()
{
herniPlan = new Mince[20];
herniPlan[0] = Mince.LITECOIN;
herniPlan[3] = Mince.LITECOIN;
herniPlan[4] = Mince.BITCOIN;
herniPlan[8] = Mince.LITECOIN;
hracVyhral = false;
hraSkoncila = false;
}
public Tah tahPocitace()
{
for(Mince m : herniPlan) {
if(m.equals(Mince.LITECOIN) || m.equals(Mince.BITCOIN)){
index = herniPlan.indexOf(m)
Tah tah = new Tah(index, 19);
}
}
}
indexOf(hra.Mince)in your snippet there is not that line