Because, Unboxing is null for a primitive data type. There is enough code to recreate this NullPointerExceptionyourself
int x;
HashMap<String,Integer> map = new HashMap<String,Integer>();
x = map.get("hello");
Auto-reporting non-existent value was a problem.
We know that to simplify the coding, autoboxing was introduced, but this is a certain anti-template performance and can lead to annoying errors like this, which are not intuitive.
autoboxing, , , , .
, mSelectedBottles.get(bottleID) null , int
Java