Ad
  • Custom User Avatar

    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.

  • Custom User Avatar

    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.

  • Custom User Avatar

    ufff. 3 hours...

  • Custom User Avatar

    Java translation kumited, please review. (author is likely inactive)

  • Custom User Avatar

    i've got the solution for java.

    open this kata for Java please.

  • Custom User Avatar

    some times it is better to type one repeated line instead of comparing something that is gonna be false the whole loop except for the first time. Keep that in mind bro.

  • Custom User Avatar

    Please, use spoiler flag next time.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution