- We should be using StringBuilder over StringBuffer. It’s a drop-in replacement, all the method names and arguments are the same.
- StringBuilder is not synchronized and therefore doesn’t require object locks everytime a method is called. The only time we’d use StringBuffer is when it’s a member variable with a possibility of multiple threads writing to it.
No comments:
Post a Comment