List<MyObject> AllData = dataBaseHelper.getAllData(); //initialize for (MyObject obj : AllData) { //loop if (obj.getNum() == num) { //condicion //code } }