Intro
This blog is about all stupid line of codes wrote by java developers (mostly). I will comment why they're stupid.
Let's start:
new String("").toString();It is a really usefull code. Just to be sure that we've got an empty String. Yes, why not complete it like that just to be sure we have an empty String.new String("").toString().substring(0, 0).trim();Of course it is a stupid code. You want an empty String.""Got it.
It is stupid to do so because "" will create a new instance of String(), new String("") will do the same and toString() is just a shortcut to this String.
No comments:
Post a Comment