I have the class Memory which is a list of blocks, and Blocks which is a list of tuples and Tuple.
Memory m;
for(Block b:m.blocklist){
for (Tuple t:b.tuplelist){
//do something
}
}
The above code works fine, every single tuple goes through it but the problem is even after the last tuple, it continues on leading to a null pointer exception. I can't modify the memory class, blocks nor tuples so how do I avoid the error?