-
String concatenation - performance?
Hi,
i got a theoretical question....
Letīs say i need to "construct" a long
string out of may smaller ones either by
writing them hard-coded or by calling
method which return String objects, what
approach is more effective - using the
concatenation operator '+' or using a
StringBuffer and the append() method (
several times )?
thx for any advice..
Volker
-
Re: String concatenation - performance?
It is the same !
The + operator makes a Stringbuffer internal in java so if you use + then
java converts it to a stringbuffer - thats way it is the same.
regards
Per
Volker Held <vheld@gwdg.de> wrote:
>Hi,
>
>i got a theoretical question....
>
>Letīs say i need to "construct" a long
>string out of may smaller ones either by
>writing them hard-coded or by calling
>method which return String objects, what
>approach is more effective - using the
>concatenation operator '+' or using a
>StringBuffer and the append() method (
>several times )?
>
>thx for any advice..
>
>Volker
>
-
Re: String concatenation - performance?
Amazing! 
Thanks for the answer, per!!!!
Volker
per wrote:
> It is the same !
> The + operator makes a Stringbuffer internal in java so if you use + then
> java converts it to a stringbuffer - thats way it is the same.
>
> regards
> Per
>
>
> Volker Held <vheld@gwdg.de> wrote:
>
>>Hi,
>>
>>i got a theoretical question....
>>
>>Letīs say i need to "construct" a long
>>string out of may smaller ones either by
>>writing them hard-coded or by calling
>>method which return String objects, what
>>approach is more effective - using the
>>concatenation operator '+' or using a
>>StringBuffer and the append() method (
>>several times )?
>>
>>thx for any advice..
>>
>>Volker
>>
>
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks