Top "Boxing" questions

Boxing is when a value type is wrapped in a reference-type wrapper for the purposes of using it when polymorphism (conversion to Object or an interface) is required.

How to convert int[] into List<Integer> in Java?

How do I convert int[] into List<Integer> in Java? Of course, I'm interested in any other answer …

java arrays collections boxing autoboxing
Why do we need boxing and unboxing in C#?

Why do we need boxing and unboxing in C#? I know what boxing and unboxing is, but I can't comprehend …

c# .net boxing
Convert an array of primitive longs into a List of Longs

This may be a bit of an easy, headdesk sort of question, but my first attempt surprisingly completely failed to …

java arrays collections boxing
How to convert byte[] to Byte[] and the other way around?

How to convert byte[] to Byte[] and also Byte[] to byte[], in the case of not using any 3rd party …

java arrays byte boxing
What is boxing and unboxing and what are the trade offs?

I'm looking for a clear, concise and accurate answer. Ideally as the actual answer, although links to good explanations welcome.

language-agnostic boxing glossary unboxing
What is the difference between boxing/unboxing and type casting?

What is the difference between boxing/unboxing and type casting? Often, the terms seem to be used interchangeably.

.net casting boxing unboxing
Why comparing Integer with int can throw NullPointerException in Java?

It was very confusing to me to observe this situation: Integer i = null; String str = null; if (i == null) { //Nothing …

java nullpointerexception boxing
Does int.class equal Integer.class or Integer.TYPE in Java?

Let's imagine one retrieves the declaring type of a Field using reflection. Which of the following tests will correctly indicate …

java reflection primitive-types boxing
In Java 8, is there a ByteStream class?

Java 8 provides Stream<T> specializations for double, int and long: DoubleStream, IntStream and LongStream respectively. However, I could …

java java-8 byte java-stream boxing
Findbugs issue with "Boxing/unboxing to parse a primitive" with Integer.valueOf(String)

I have this piece of code: public void someMethod(String id) { someOtherMethod(Integer.valueOf(id)); } public void someOtherMethod(int id) { // …

java findbugs boxing unboxing