<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 21 Aug 2019, at 12:38, Edward Welbourne <<a href="mailto:edward.welbourne@qt.io" class="">edward.welbourne@qt.io</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="">On Tuesday, 20 August 2019 08:56:06 PDT Bogdan Vatra via Development wrote:<br class="">
<blockquote type="cite" class="">
<blockquote type="cite" class="">
<blockquote type="cite" class=""><br class="">
</blockquote>
</blockquote>
</blockquote>
<blockquote type="cite" class="">
<blockquote type="cite" class="">
<blockquote type="cite" class="">All the major frameworks out there (i.e. Java, C#) they have a<br class="">
single String which does all the magic.<br class="">
</blockquote>
</blockquote>
</blockquote>
<br class="">
Yes, and those systems are all built with the assumption that client<br class="">
code doesn't care if every single time anything happens to a string a<br class="">
fresh copy of it is made.</div>
</div>
</blockquote>
<br class="">
</div>
<div>In Java, String is immutable, and often “interned”, in which case there are no copies of any two strings that have the same bytes.  </div>
<div>
<div><a href="https://stackoverflow.com/questions/10578984/what-is-java-string-interning" class="">https://stackoverflow.com/questions/10578984/what-is-java-string-interning</a></div>
<div><br class="">
</div>
</div>
<div>But concatenating multiple immutable strings will make a new one, and the old ones could be garbage if you no longer keep references to them; so there are StringBuilder and StringBuffer, as workarounds to make that faster.  And then the compiler got smarter: <a href="https://stackoverflow.com/questions/1532461/stringbuilder-vs-string-concatenation-in-tostring-in-java" class="">https://stackoverflow.com/questions/1532461/stringbuilder-vs-string-concatenation-in-tostring-in-java</a></div>
<div><br class="">
</div>
</body>
</html>