How to convert String to int in Groovy the right way

Viewed 33785

First of all, I am aware of question 'Groovy String to int' and it's responses. I am a newbe to Groovy language and right now playing around some basics. The most straightforward ways to convert String to int seem to be:

int value = "99".toInteger()

or:

int value = Integer.parseInt("99")

These both work, but comments to these answers got me confused. The first method

String.toInteger()
is deprecated, as stated in groovy documentation. I also assume that

Integer.parseInt()
makes use of the core Java feature.

So my question is: is there any legal, pure groovy way to perform such a simple task as converting String to an int?

2 Answers
Related