switch versus if ... else if ... else
No. 210
Q: |
Consider a method
static int computeItemCount() {...} This method will be called by two different implementations
of another method
An experienced programmer claims these two implementations
possibly return different results when executing
Tip
|
||||
A: |
On a fresh start On contrary the
In order for both implementations to become aligned we need
a small modification on the
This way both implementations are in complete sync. (At least despite runtime efficiency and possible OutOfMemoryErrors) |