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.

Java: What's the difference between autoboxing and casting?

This question is about "Why does autoboxing make some calls ambiguous in Java?" But reading through the answers, there are …

java casting autoboxing
What does it mean to say a type is "boxed"?

I have heard of types being referred to as "boxed" in some languages. In Java, I have heard of "autoboxing". …

java types terminology type-systems autoboxing
Initializing a Double object with a primitive double value

What is happening when a java.lang.Double object is initialized without using a call to the constructor but instead …

java autoboxing
Java: Array of primitive data types does not autobox

I have a method like this: public static <T> boolean isMemberOf(T item, T[] set) { for (T t : …

java generics autoboxing
Java: Is it ok to set Integer = null?

I have a function that returns an id number if the argument exists in the database. If not, it returns …

java integer autoboxing error-code
Comparing doubles in Java gives odd results

I really can'get my head around why the following happens: Double d = 0.0; System.out.println(d == 0); // is true System.out.…

java double equals autoboxing
java: boolean instanceOf Boolean?

I'm a bit confused: I have a function, that takes an Object as argument. But the compiler does not complain …

java casting boolean primitive autoboxing
Weird Integer boxing in Java

I just saw code similar to this: public class Scratch { public static void main(String[] args) { Integer a = 1000, b = 1000; System.…

java autoboxing
Booleans, conditional operators and autoboxing

Why does this throw NullPointerException public static void main(String[] args) throws Exception { Boolean b = true ? returnsNull() : false; // NPE on …

java nullpointerexception boolean conditional-operator autoboxing
Performance impact of autoboxing

Usually the compiler generates code to perform boxing and unboxing. But what does the compiler, if the boxed values are …

java performance autoboxing