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.
Indeed, that
clever
solution was based on StringBuilder.Indeed, that
clever
solution was based on StringBuilder.I made some tests:
value = 100 000
That "clever" test execution time = 5 seconds
When using StringBuilder = 30 ms
Use method chaining. It will be much more faster cos JVM can optimize .append().append() calls.
It's not clever cos your are using String instead of StringBuilder.
Read more about Java String Pool.
Did you heard about Java String Pool? Do not follow this way cos you are producing a lot of garbage in PermGen (Metaspace).