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.

Boxing and unboxing with generics

The .NET 1.0 way of creating collection of integers (for example) was: ArrayList list = new ArrayList(); list.Add(i); /* boxing */ int …

c# .net generics boxing unboxing
C# non-boxing conversion of generic enum to int?

Given a generic parameter TEnum which always will be an enum type, is there any way to cast from TEnum …

c# .net enums boxing
How do I get an IntStream from a List<Integer>?

I can think of two ways: public static IntStream foo(List<Integer> list) { return list.stream().mapToInt(Integer::…

java collections java-8 java-stream boxing
Compiler error : reference to call ambiguous

Case 1 static void call(Integer i) { System.out.println("hi" + i); } static void call(int i) { System.out.println("hello" + …

java methods polymorphism java-7 boxing
Type Casting an Object using a "Type" Object in C#

This one has proven to be a little tricky for me so far. I am wondering if it is possible …

c# reflection casting types boxing
Why are Python's arrays slow?

I expected array.array to be faster than lists, as arrays seem to be unboxed. However, I get the following …

python arrays performance boxing python-internals
Structs, Interfaces and Boxing

Possible Duplicate: Is it safe for structs to implement interfaces? Take this code: interface ISomeInterface { public int SomeProperty { get; } } struct …

c# struct interface value-type boxing
Why does the assignment of a short variable to an Integer reference produce a compile time error?

I have the following code in Java : class Boxing { public static void main(String args[]) { short s = 10; Integer iRef = s; } } …

java casting type-conversion boxing
Java signed zero and boxing

Lately I've written a project in Java and noticed a very strange feature with double/Double implementation. The double type …

java double boxing
Cast Boxed Object back to Original Type

I expect there's one of two answers to this, either impossible or extremely simple and I've overlooked the obvious Google …

c# generics reflection event-handling boxing