The simple answer is: do not do this. Because such code is difficult to read and maintain.
If at all, do something like
switch(computeLookupValue(whatever))
But your idea of ββdoing so many things in a few lines of code is bad practice.
And then also forget this part about efficiency. In Java, you write efficient code by writing simple code that can only be optimized for a time compiler. Trying to write smart Java source code can quickly result in you not letting JIT do the work!
source share