I tried a little debugging... I did the following:
Code:
int i = 0;
for(Unit unit : list){
System.err.println("Listnr: "+ i++);
if(unit != null) {
System.err.println("Unitnr: "+ unit.getUnitID() +" - Unitname: "+ unit.getUnitName());
}
}
That gave me the following result:
Code:
Listnr: 0
Listnr: 1
Unitnr: 1 - Unitname: Unit 1
Listnr: 2
Listnr: 3
Listnr: 4
Listnr: 5
Listnr: 6
Listnr: 7
Unitnr: 7 - Unitname: Unit 2
Listnr: 8
Listnr: 9
Listnr: 10
Unitnr: 10 - Unitname: Unit 3
Listnr: 11
Unitnr: 11 - Unitname: Unit 4
Listnr: 12
Unitnr: 12 - Unitname: Unit 5
So basically, it means that the list gets filled with null values like this:
Code:
list(null,unit1,null,null,....)
because the database says: 1-unit1, 7-unit2, ... but I don't want that. I only want the units to be in the list, not null values. So like this:
Code:
list(unit1,unit2,...,unit12)
How do I do that?