Top "Autoboxing" questions

Boxing is the process of using an object to wrap a primitive value so that it can be used as a reference object; extracting a previously-boxed primitive is called unboxing.

A boxed value is unboxed and then immediately reboxed

I am getting the Findugs error "A boxed value is unboxed and then immediately reboxed". This is the Code: Employee …

java findbugs autoboxing
Returning null as an int permitted with ternary operator but not if statement

Let's look at the simple Java code in the following snippet: public class Main { private int temp() { return true ? null : 0; // …

java nullpointerexception conditional-operator autoboxing
Autoboxing: So I can write: Integer i = 0; instead of: Integer i = new Integer(0);

Autoboxing seems to come down to the fact that I can write: Integer i = 0; instead of: Integer i = new Integer(0); …

java autoboxing
Autoboxing versus manual boxing in Java

Why is the second piece of code faster? Map<Integer, Double> map = new HashMap<Integer, Double>(); …

java autoboxing
What is the appropriate way to handle warning: "The expression of type x is boxed into x"

I'm not looking to to turn off or ignore the warning as in The expression of type x is boxed …

java eclipse autoboxing
How does auto boxing/unboxing work in Java?

Since JDK 5.0, auto boxing/unboxing was introduced in Java. The trick is simple and helpful, but when I started testing …

java autoboxing unboxing
When using == for a primitive and a boxed value, is autoboxing done, or is unboxing done

The following code compiles (with Java 8): Integer i1 = 1000; int i2 = 1000; boolean compared = (i1 == i2); But what does it do? Unbox …

java autoboxing
Why does autoboxing in Java allow me to have 3 possible values for a boolean?

Reference: http://java.sun.com/j2se/1.5.0/docs/guide/language/autoboxing.html "If your program tries to autounbox null, it …

java wrapper primitive autoboxing unboxing
How to use (primitive) autoboxing/widening with Hamcrest?

I came across https://code.google.com/p/hamcrest/issues/detail?id=130 to add some sugar syntax for Hamcrest matchers. …

java autoboxing hamcrest
The expression of type x is boxed into X?

I'm a little confused by a warning that my Eclipse IDE is currently writing next to every expression where types …

java eclipse autoboxing