Implicit type conversion via static #valueOf method #4

Closed
amelentev opened this Issue Nov 17, 2012 · 1 comment

Comments

Projects
None yet
1 participant
@amelentev
Owner

amelentev commented Nov 17, 2012

For be able to write

BigInteger a = 123

instead of

BigInteger a = BigInteger.valueOf(123)

Scala equivalent to:

implicit def intToBigInteger(x: Int) = BigInteger.valueOf(x)

@ghost ghost assigned amelentev Nov 17, 2012

@amelentev

This comment has been minimized.

Show comment
Hide comment
@amelentev

amelentev Nov 17, 2012

Owner

This is already performed by javac for Integer, Double and other wrapper classes (boxing):

Integer a = 123 

transforms to

Integer a = Integer.valueOf(123)
Owner

amelentev commented Nov 17, 2012

This is already performed by javac for Integer, Double and other wrapper classes (boxing):

Integer a = 123 

transforms to

Integer a = Integer.valueOf(123)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment