unboxing Questions

3

Solved

I'm having a hard time understanding this. Consider the following example: protected void Page_Load(object sender, EventArgs e) { // No surprise that this works Int16 firstTest = Convert.ToInt16...
Brandi asked 7/1, 2012 at 17:12

1

I am trying to use Haskell for data analysis. Because my datasets are reasonably large (hundreds of thousands and potentially millions of observations), I would ideally like to use an unboxed data ...
Lawson asked 13/11, 2011 at 9:3

1

Solved

In the following code, I am getting a compilation error stating that I have a type mismatch on 'x': val someRef: java.lang.Long = 42L someRef match { case x: Long => println("The answer: " + x...
Disuse asked 11/10, 2011 at 16:27

2

Solved

What i'm trying to achieve here is a straight value comparison of boxed primitive types. ((object)12).Equals((object)12); // Type match will result in a value comparison, ((object)12).Equals((obje...
Automaton asked 12/7, 2011 at 17:49

4

Solved

Are 2 and 3 boxing/unboxing examples? 1) The documentation example: int i = 123; object iBoxed = i; i = (int) iBoxed; 2: Is the boxing/unboxing as well? int i = 123; object iBoxed = i; i = In...
Scully asked 6/6, 2011 at 8:11

4

Solved

Does Java 5 or higher apply some of form of "boxing" to arrays? This question came to mind as the following code goes through an array as if it's an Iterable. for( String : args ){ // Do stuff } ...
Doubly asked 2/6, 2011 at 15:36

5

Solved

Today I stumbled upon an interesting bug I wrote. I have a set of properties which can be set through a general setter. These properties can be value types or reference types. public void SetValue...
Runofthemine asked 1/6, 2011 at 17:6

3

Solved

I this MSDN Magazine article, the author states (emphasis mine): Note that boxing always creates a new object and copies the unboxed value's bits to the object. On the other hand, unboxing si...
Handmaiden asked 5/6, 2010 at 0:53

3

Solved

We are currently doing some iterations and other operations using x++; where x is an Integer and not an int. Operations may be repeated throughout some user operations on our system but nothing t...
Annmaria asked 17/5, 2011 at 21:29

2

Solved

Integer integer1 = 127; Integer integer2 = 127; System.out.println(integer1 == integer2);//true integer1 = 128; integer2 = 128; System.out.println(integer1 == integer2);//false I found it ...
Tantalate asked 7/4, 2011 at 13:32

1

Solved

Does boxing/unboxing occur when a method accepts an out/ref parameter of a ValueType?
Grenoble asked 24/2, 2011 at 10:7

2

Solved

In the accepted best response to this question, there is a clear explanation why boxing happens. However, if I decompile the code (using java decompiler) I cannot see use of scala.runtime.BoxesRu...
Antalya asked 13/2, 2011 at 5:4

2

Solved

I have a class that extends the LinkedList class. Here's an excerpt of the code: class SortedList<Integer> extends LinkedList<Integer> { int intMethod(Integer integerObject){ return ...
Karrah asked 6/2, 2011 at 7:30

4

Solved

I have a console application that allows the users to specify variables to process. These variables come in three flavors: string, double and long (with double and long being by far the most common...
Sigridsigsmond asked 27/1, 2011 at 23:33

4

Solved

I'm aware that boxing and unboxing are relatively expensive in terms of performance. What I'm wondering is: Does passing a value type to a method's out parameter cause boxing/unboxing of the vari...
Autoerotic asked 26/1, 2011 at 16:29

3

Solved

Possible Duplicates: Why do we need boxing and unboxing in C#? What is boxing and unboxing and what are the trade offs? In C# what does "Box and Unbox" mean? Here's an extract fr...
Lorie asked 25/1, 2011 at 14:33

6

Solved

The .NET 1.0 way of creating collection of integers (for example) was: ArrayList list = new ArrayList(); list.Add(i); /* boxing */ int j = (int)list[0]; /* unboxing */ The penalty of using this ...
Ampliate asked 9/12, 2010 at 20:59

3

Solved

Consider the following:: Object box = 5; int @int = (int)box; // int = 5 int? nullableInt = box as int?; // nullableInt = 5; StringComparison @enum = (StringComparison)box; // enum = OrdinalIgnore...
Plano asked 26/10, 2010 at 17:45

2

Solved

I'm trying to write a small script which parses and executes Brainfuck code, to understand the GHC options of optimization, I'm trying to optimize the code in order to be a bit faster and to unders...
Yettie asked 4/9, 2010 at 9:5

5

Solved

I got the following code: object var3 = 3; Console.WriteLine(var3.GetType().ToString()); Console.WriteLine(typeof(object).ToString()); The output is: System.Int32 System.Object Why aren't the...
Cistaceous asked 10/8, 2010 at 8:50

9

Reference: http://java.sun.com/j2se/1.5.0/docs/guide/language/autoboxing.html "If your program tries to autounbox null, it will throw a NullPointerException." javac will give you a compile-tim...
Savell asked 27/5, 2010 at 17:11

4

Solved

I'm trying to figure out syntax that supports unboxing an integral type (short/int/long) to its intrinsic type, when the type itself is unknown. Here is a completely contrived example that demonst...
Mcroberts asked 19/5, 2010 at 20:15

1

I would like to manipulate matrices (full or sparse) efficiently with haskell's vector library. Here is a matrix type import qualified Data.Vector.Unboxed as U import qualified Data.Vector as V ...
Subterrane asked 29/4, 2010 at 14:7

5

Solved

I have a Dictionary(TKey, TValue) like Dictionary<int, ArrayList> Deduction_Employees = new Dictionary<int, ArrayList>(); and later I add to that array list an anonymous type like ...
Kiss asked 19/2, 2010 at 21:15

4

Solved

I am a big fan of auto-boxing in Java as it saves a lot of ugly boiler plate code. However I have found auto-unboxing to be confusing in some circumstances where the Number object may be null. Is t...
South asked 9/1, 2010 at 13:28

© 2022 - 2024 — McMap. All rights reserved.