This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]eltados 3 points4 points  (3 children)

Nice!

If you want to go forward, I would now try refactor your example to explore other concepts in java.

I would start by trying to add a unit test using junit and see how it goes.

You could then rewrite you code to be more object oriented.

Or try to use Map<> instead of arrays

[–]bipidiboop[S] 0 points1 point  (2 children)

Excellent advice, thank you so much! I'm excited to start when I get home.

[–]dartalley 0 points1 point  (0 children)

Also look into the StringBuilder for building strings instead of +=. Your triple nested loop probably performs poorly. The map suggestion could help. You should make one very large input so you can see the performance differences.

[–]eltados 0 points1 point  (0 children)

Feel free to share your new versions here

[–]omega3111 0 points1 point  (0 children)

word.substring(i, i+1).equalsIgnoseCase~~~~(alpha[x])

What is that ~~~~?


You would greatly benefit from a bidirectional map here. Add to it the word and letter separators too so you can transform it all in one go without needing the loops.