autoboxing Questions
2
Solved
Is there a way how to disable auto-boxing for Java 5 and 6 in IntelliJ IDEA, to not allow a developer to use this feature in the IDE?
Dacoity asked 4/4, 2013 at 18:27
4
Solved
I have this singleton I'm trying to use, but getInstance can apparently return null:
class Singleton {
public static final String K_LEVEL = "level";
static Singleton instance = new Singleton();
...
Lanellelanette asked 26/3, 2013 at 21:34
3
Solved
I've searched for the use of @specialized in the source code of the standard library of Scala 2.8.1. It looks like only a handful of traits and classes use this annotation: Function0, Function1, Fu...
Stillage asked 29/3, 2011 at 19:14
9
Solved
I have been told to never use == for strings but for everything else because .equals would compare the values rather than the instances of the object. (Which I understand the difference of).
Accor...
Riebling asked 11/11, 2011 at 14:22
2
Solved
Is this autoboxing?
Object ob = 8;
Will the above code first wrap the int literal 8 in an Integer and then assign its reference to variable ob? Because the java language specification has nothin...
Dewy asked 28/2, 2013 at 15:17
1
Solved
I would like to generate warnings for ALL autoboxing and unboxing.
Has anyone found an effective way?
Eclipse catches basic autoboxing errors: eg. Integer i = null; i++. But fails on anything com...
Funiculate asked 22/2, 2013 at 9:16
3
Solved
Today I've been playing around with Eclipse Juno. Coming from Helios it is a great upgrade. Everything is working fine, except one new compile error.
We are using the java.net framework 'Fuse' and...
Utley asked 4/7, 2012 at 6:18
6
Solved
public class Test {
public static void main(String[] args) {
String s = null;
String s1 = null;
Integer i = null;
Integer i1 = null;
System.out.println(s+i);
System.out.println(i+s);
Syst...
Glottis asked 26/1, 2013 at 16:24
7
Solved
Why groups j=k*l and m=n*o have different performance, while first 3 groups have the same ?
int a = 42;
int b = 42;
int c = 42;
Integer d = 42;
int e = 42;
int f = 42;
int g = 42;
Integer h = 42...
Triplicity asked 28/1, 2013 at 8:17
2
Solved
Just trying to understand auto-boxing, which I do apart from one thing:
Short s = 250;
Long l = 250;
The assignment to Long l fails. This, I expect, is because you cannot widen then box (i.e. it...
Anabiosis asked 20/1, 2013 at 14:43
2
I've been looking at autoboxing in Objective-C (here, for instance). Is there a new syntax for unboxing?
For instance, I want to do this but shorter:
NSArray *oneNumber = @[@1];
int one = ((NSNu...
Photoactinic asked 15/1, 2013 at 16:30
7
Solved
This question is about "Why does autoboxing make some calls ambiguous in Java?"
But reading through the answers, there are a number of references to casting and I'm not sure I completely understan...
Arnoldoarnon asked 1/2, 2009 at 21:53
1
Solved
Possible Duplicate:
Java: Long result = -1: cannot convert from int to long
For example Integer foo = 4 and Long foo = 4L both compile, but Long foo = 4 doesn't. Is there a rationale ...
Rill asked 17/12, 2012 at 13:14
2
Solved
The following program prints respectively 'false' and 'true':
Number n = true ? new Long(1) : new Double(2.0);
System.out.println(n instanceof Long);
System.out.println(n instanceof Double);
So ...
Forage asked 8/10, 2012 at 20:20
3
Solved
I tripped across a really strange NullPointerException the other day caused by an unexpected type-cast in the ternary operator. Given this (useless exemplary) function:
Integer getNumber() {
retu...
Brick asked 6/10, 2012 at 21:21
4
Solved
I am a java novice and so confused by the following example. Is it okay to think that "==" sign will compare the values between Integers and "autoboxed" Integers from int, and compare reference add...
Near asked 24/9, 2012 at 6:3
3
Solved
When you concatenate a String with a primitive such as int, does it autobox the value first.
ex.
String string = "Four" + 4;
How does it convert the value to a string in Java?
Softboiled asked 16/9, 2012 at 7:10
3
I am getting the Findugs error "A boxed value is unboxed and then immediately reboxed".
This is the Code:
Employee emp = new Employee()
Long lmt = 123L;
emp.setLimit(Long.valueOf(lmt));
In th...
Capacity asked 22/8, 2012 at 5:18
1
Solved
In Scala,
{ x: Option[Int] => x }
.getClass
.getMethod("apply", classOf[Option[_]])
.getGenericParameterTypes
returns Array(scala.Option<java.lang.Object>). I'd initially been expec...
Schoenburg asked 23/6, 2012 at 6:30
3
Solved
I program in Java, C and Python.
The rule for automatic coercions among arithmetic types have been
augmented to handle the richer set of types
Source: "The C Programming Language"...
Lawsuit asked 18/6, 2012 at 15:34
4
Solved
I'm learning Java on my own; and therefore the code below has no function other than for learning/testing.
Essentially I'm trying to modify the elements of an Integer array (namely, halving them) ...
Ament asked 14/6, 2012 at 11:36
1
Solved
For performance and safety I would like to implement a fixed-size vector which is both immutable and specialized (I need fast arithmetics). My first idea was to use the @specialized annotation (bec...
Roderica asked 21/4, 2012 at 9:28
1
Solved
I have a trait and an implementation looking like:
trait Foo[A] {
def bar[B >: A: Ordering]: Foo[B]
}
class FooImpl[A]( val a: A, val values: List[Foo[A]] ) extends Foo[A] {
def bar[B >: A...
Busman asked 17/4, 2012 at 15:58
1
Solved
Possible Duplicate:
Tricky ternary operator in Java - autoboxing
We know that int roomCode = null; is not allowed by the compiler.
Then why the Code 1 doesn't give a compiler error, ...
Turley asked 23/2, 2012 at 5:49
6
Solved
I noticed today that auto-boxing can sometimes cause ambiguity in method overload resolution. The simplest example appears to be this:
public class Test {
static void f(Object a, boolean b) {}
s...
Afterbrain asked 1/2, 2009 at 19:20
© 2022 - 2024 — McMap. All rights reserved.