I have this code:
for (RoomProperties RP : roomHashMap.values()) {
canvas.drawRect(RP.left, RP.top, RP.right, RP.bottom, snowWhite);
}
it's properly compiled. But the rectangle simply will not be drawn, so I entered debug mode and sure enough there are these errors:
RP.left Cannot find local variable 'RP' RP.right Cannot find local variable 'RP'
Now, this is practically confusing. Suppose I didn't get the for each right, but why was it compiled and run???
What's the proper way to do foreach and what's wrong with the compiler not reporting error (I probably ignored warnings)?