Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
charAt() returns char, how do i implicitly convert to int.?If you are suggesting casting, it still gives the ascii value. Do let me know what your thoughts exactly were.
charAt() returns char, how do i implicitly convert to int.?
Thanks yourself! My solution could use a lot of improvement; I'm just getting back into codewars and programming puzzles.
Streams can be very effective. I'd say they are mandatory knowledge for Java devs.
And to clarify my OP regarding
Character.getNumericValue()
, I like it because it's very explicit that you're retrieving a number value rather than implicitly converting from char to int withString.charAt()
.Your Solution is really awesome, i really have to learn streams, i see this being used a lot in one line code format.
Thanks @ahjota.
I kind of like the use of
Character.getNumericValue()
here.This line
.mapToInt(value -> value)
is redundant. Themap()
stage before it already converts the string array to an Integer, so you might as well mapToInt() directly.This comment is hidden because it contains spoiler information about the solution