« Return to Thread: Question about Int boxing/unboxing

Re: Question about Int boxing/unboxing

by Martin Odersky :: Rate this Message:

| View in Thread

On Sat, Mar 28, 2009 at 5:17 PM, Joachim Ansorg
<nospam@...> wrote:
> Hi,
> I was looking at Scala's way to convert scala.Int to java.lang.Integer.
> I noticed that Scala calls different methods to convert an Int into an Integer
> (see attached code).
>
> Predef.int2Integer always creates a new java.lang.Integer . Couldn't it just
> use BoxesRunTime.boxToInteger(Int) as well? boxToInteger caches the values
> between -128 - 1024 .
>
I think we'll migrate both to Int.valueOf for Scala 2.8.

Cheers

 -- Martin

 « Return to Thread: Question about Int boxing/unboxing