unboxing Questions

2

Solved

I have the following return statement: public Boolean foo(String booleanString){ return ("true".equals(booleanString) ? true : ("false".equals(booleanString) ? false : null)); } when boo...
Nuncio asked 6/5, 2015 at 13:58

2

Solved

I know its a very basic question but I want to be clear about the concept. I want to know how == operator works in case of primitive and object type. For example Integer a = 1; int b = 1; System.o...
Eddie asked 19/3, 2015 at 7:37

2

Solved

Here is a test program: main = do n <- fmap read $ getLine :: IO Int if (999999 == n) then putStrLn "equal" else return () And here is the relevant bit of core when compiled with ghc --make...
Predictory asked 17/12, 2014 at 18:9

1

Is there a Haskell library for automatic differentiation which works with unboxed vectors? The grad function from Numeric.AD requires an instance of Traversable, which Data.Vector.Unboxed is not.
Statistics asked 27/3, 2014 at 17:23

4

Solved

I understand what boxing is. A value type is boxed to an object/reference type and is then stored on managed heap as an object. But I can't get thru unboxing. Unboxing converts your object/referen...
Perisarc asked 30/7, 2014 at 11:11

8

Solved

Edit: Comments at bottom. Also, this. Here's what's kind of confusing me. My understanding is that if I have an enum like this... enum Animal { Dog, Cat } ...what I've essentially done is d...
Titfer asked 7/1, 2011 at 14:22

1

Solved

Suppose I have a simple data type like: data Cell = Open | Blocked and I'd like to use a UArray Int Cell. Is there an easy way to do this? Can I somehow reuse the definition for UArray Int Bool?...
Muzz asked 20/2, 2014 at 2:33

1

Solved

Overview (forgive me for being so detailed, but I'd rather it be too much than too little): I'm attempting to edit the Dapper source for our solution in such a way that when any DateTime or Nullabl...
Paxwax asked 11/2, 2014 at 19:29

2

Solved

I'm working with an interface that takes type Object as its input. This is unfortunate for me as I have primitive data that I sometimes need to pass in through the interface. This of course forces ...
Abroach asked 2/8, 2011 at 3:7

5

Solved

public class T1 { public static void main(String[] args) { // TODO Auto-generated method stub Integer i1 = 1000; Integer i2 = 1000; if(i1 != i2) System.out.println("different objects"...
Turgot asked 26/12, 2013 at 12:12

2

Solved

lets say, i have the following code in c# int x = 0; x.ToString(); does this internally does a boxing of x? Is there a way to see this happening from visual studio?
Ormuz asked 4/9, 2013 at 13:46

3

Solved

I recently tried to run the following two snippets of code and was surprised at the output. First: // ... System.out.println( (Boolean)null || true ); // ... Second: // ... System.out.printl...
Rockandroll asked 23/8, 2013 at 2:32

2

Solved

I have noted a difference in auto unboxing behavior between Java SE 6 and Java SE 7. I'm wondering why that is, because I can't find any documentation of changes in this behavior between these two ...
Bestride asked 20/4, 2013 at 11:10

2

For example, look at this code: Integer myInt = new Integer(5); int i1 = myInt.intValue(); int i2 = myInt; System.out.println(i1); System.out.println(i2); As you can see, I have two ways of copy...
Deteriorate asked 13/4, 2013 at 8:41

6

Solved

If you run the following code, public class Foo{ public static void main(String[] args){ int id = new Bar().getId(); // throws unexpected NullPointerException } private static class Bar{ pri...
Jer asked 20/2, 2013 at 23:44

2

I'm having trouble finding good resources that work for how to make my data types unboxed, for use in an unboxed vector. How would I make the data type data Color = Yellow | Red | Green | Blue | E...
Intendant asked 28/11, 2012 at 7:35

2

Solved

Background: I'm developing for the xbox and am at the optomising stage. I need to cut down on object allocations. One place to start is finding out where (un)boxing occurs. I'm very new to IL (in ...
Goldi asked 20/6, 2011 at 20:11

2

Solved

Below is some quick code to illustrate my question. Any way to avoid this apparently unnecessary boxing/unboxing? public class TestClass<T> { public T TestMethod() { if (typeof(T) == type...
Sama asked 8/11, 2012 at 21:16

3

Solved

For example: int anInt = null; fails at compile time but public static void main(String[] args) { for (int i = 0; i < 10; i++) { System.out.println("" + getSomeVal()); } } public static i...
Parasynthesis asked 10/8, 2012 at 8:21

6

Solved

Another recent C# interview question I had was if I knew what Boxing and Unboxing is. I explained that value types are on Stack and reference types on Heap. When a value is cast to a reference type...
Sethsethi asked 18/4, 2009 at 21:10

6

Solved

This is not a question of what is boxing and unboxing, it is rather why do languages like Java and C# need that ? I am greatly familiar wtih C++, STL and Boost. In C++ I could write something lik...
Drumfish asked 24/6, 2009 at 19:19

1

Solved

I've got a numeric application that does a lot of work with negative logs of probabilities, which (since probabilities range from zero to one) take the values of positive doubles, or negative infin...
Boyish asked 2/6, 2012 at 23:22

1

Solved

I've been trying to understand this paragraph, but somehow I couldn't virtualize it in my mind, some one please elaborate it little bit: Unboxing is not the exact opposite of boxing. The unboxin...
Ranket asked 14/4, 2012 at 2:3

1

Solved

What I understand unboxing is when I take a object and unbox it to valuetype like the MSDN example: int i = 123; object o = i; o = 123; i = (int)o; // unboxing So I just was thinking, can a str...
Ng asked 23/3, 2012 at 16:34

4

I read What is boxing and unboxing and what are the trade offs? but can't understand one thing. Suppose I have a class: class MyClass { public int Value { get; set; } } And I want to get value ...
Orthopedics asked 10/1, 2012 at 20:20

© 2022 - 2024 — McMap. All rights reserved.