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.
I disagree, it's only false the first time, but it needs to be checked for each letter. Not needed, since we can add the "-" for each loop, and just remove the last char from the StringBuilder. Check my solution.
Check it again: it's only false the first time. It's true for the rest of the loop.
While it's possible in Java 7 to resolve this without that if statement, it requires manually creating the head and tail, or doing weird things with the indices, or other things that reduce the overall readability of the code. This reduction in readibility is usually not worth the elimination of a single if statement.
Anymore, the real solution would be to turn the char array into a stream, zip the index to it, process each element in the stream, then join the whole thing together on the dash. Keep that in mind bro.
Such as here.
Please, use spoiler flag next time.