OFBiz
›
OFBiz - Dev
Search
everywhere
only in this topic
Advanced Search
a StringBuffer/StringBuilder anti-pattern
‹
Previous Topic
Next Topic
›
Classic
List
Threaded
♦
♦
Locked
1 message
Adam Heath-2
Reply
|
Threaded
Open this post in threaded view
♦
♦
|
a StringBuffer/StringBuilder anti-pattern
--
StringBuffer sb = new StringBuffer();
sb.append("foo");
while (...) {
...
sb.append("message [" + variable + "] more text [" + another + "]");
}
--
Using '+' when adding to a StringBuffer/StringBuilder allocates more
temporary objects.
Free forum by Nabble
Edit this page