Here is some trick to let the code run faster, I face this long time ago, finally I am able to write it down.
For CodeA & CodeB:
The different will be very big when the String Array gone larger. If let say the size of the String Array is 100, CodeA will create 100 Integer object to store it's size, the program will end up like this CodeC.
Obviously, every loop set the String Array size is unnecessary. So, it is alway better to keep CodeB practice.
No comments:
Post a Comment