I just want to make sure I'm clear on this, as I'm not quite sure of the exact behavior. I have two arrays:
private short[] bufferA;
private short[] bufferB;
which I want to swap between. Can I do something like this:
private short[] currentBuffer;
while(something)
{
currentBuffer = (condition) ? bufferA : bufferB;
modify(currentBuffer);
}
to modify the bufferA or bufferB depending on some condition, or should I use flags and manually code it like this:
private int currentBuffer;
while(something){
currentBuffer = (condition) ? BUFFER_A : BUFFER_B;
if(currentBuffer == BUFFER_A) {
modify(bufferA);
}else{
modify(bufferB);
}
}
The code I'm working with is more complex than this simplified example, so if I can do it the first way that would be much preferred.