I read the O'REILLY Java8 pocket guide when I came across this unpacking tip [On page 30]
Note. For these examples, primitive variables end in capital. This is not an agreement.
The following example shows the acceptable but not recommended use of unboxing
Set Weight Gain
weightLimitP = weightLimitP + weightAllowanceW;
It is better to write this expression using the method intValue()as shown below:
weightLimitP = weightLimitP + weightAllowanceW.intValue();
Question . What I would like to know here, why is the second approach the best way? I mean, in what conditions is it "better." How is it different from unboxing in itself
Note. Shell class in this exampleInteger