Positioning boxes in a grid
Version A is definitely better, as it employs a more familiar pattern to get the job done, and it makes use of bit of trivial code (boolean lIsFirstIteration = lBbox == lPreviousBbox) to save you from duplication of non-trivial code. (lIndexFromBbox.put(lPreviousBbox, lCurrentIndex))

I would trivialize the trivial code even more, by saying bool IsFirstIteration = true right before entering the loop, and IsFirstIteration = false as the last instruction of the loop. Note that even though this is two lines of code instead of one, its complexity is smaller, because it deals with constants, not with variables.

I could perhaps give more advise if you explained what you mean by 'algorithm to position boxes in a grid'.  A grid is generally thought of as a two-dimensional structure, but I only see operations in one dimension, on variables which are defined outside of the code fragment that you provided, so... what is this code trying to accomplish?