Listing 21. Set the StringBuilder message.
清单21.设置StringBuilder消息。
Listing 20. Get the StringBuilder message.
清单20 .获取StringBuilder消息。
If you know you are going to build up a string in a single thread, use StringBuilder.
如果知道要在单线程中构建字符串,就使用StringBuilder。
Isn't it time for some recycling, i.e. reusing the same global StringBuilder for every email received?
这不是用于循环的时间吗,从新使用一个全局性的Stringbuilders为每一个收到的email ?
The purpose of using the unsynchronized StringBuilder was to provide a baseline measurement of performance.
之所以使用非同步的StringBuilder,是为了提供一个测量性能的基线。
StringBuilder; one is immutable and changes to it cause the creation of a new copy, the other allows for in-place modification.
一个是不可变的,当需要修改的时候它会创建一个新的副本,而另一个则允许直接在其上进行修改。
In this shot the large frame in the upper right shows the disassembly of the timing wrapper method added to the StringBuilder class.
在这个快照中,右上角的大帧显示了添加到stringbuilder类中的计时包装器方法的分解。
Does it make sense to use ropes to compute the value of x, rather than a StringBuilder, which is what the compiler generates by default?
用rope代替编译器默认生成的StringBuilder来计算x的值是否有意义?
These methods aren't overly spectacular, but they allow you to avoid using the Formatter object directly and creating an intermediate StringBuilder.
这些方法不是很显眼,但是有了它们就可以避免直接使用Formatter对象并创建中间的StringBuilder 。
It'll generate the HTML files in the current directory. For example, here I'll disassemble the StringBuilder class I used for my timing example.
它会在当前目录中生成html文件。
Note the StringBuilder and the appending of data, used because a particular data element can be processed across multiple reads on the InputSource.
注意,使用StringBuilder和附加数据是因为一个特定数据在InputSource上能通过多个读取来进行处理。
If you want to get the value of Pi to 10 digits of precision, the code in Listing 3 will put that value into the StringBuilder and print the output.
如果希望得到精度为10位数字的pi值,清单3中的代码会将这个值放到StringBuilder中并打印输出。
In part one of this article we used a single threaded benchmark to compare the performance of the synchronized StringBuffer to the unsynchronized StringBuilder.
在本文的第一部分中,我们通过一个单一线程的基准,比较了同步的StringBuffer和非同步的StringBuilder之间的性能。
The StringBuilder class in the System.Text namespace joins strings together without allocating a new string instance each time; this efficiency greatly improves memory utilization.
Text命名空间中的StringBuilder类无须每次分配新的字符串实例即可将字符串连接在一起;这一效率大大改进了内存的利用。
Given the single threaded nature of this benchmark, I was fully expecting Escape Analysis to elide the lock thus rendering StringBuffer performance equivalent to that of StringBuilder.
明确了这个基准测试的单线程化的本质后,我期待着逸出分析会消除锁,从而将StringBuffer的性能提到了与StringBuilder相同的水平。
It has two other internal variables, a currentMessage for a Message instance that is being parsed, and a StringBuilder variable called builder that stores character data from text nodes.
它有另外两个内部变量,currentMessage 针对被解析的Message实例,以及名称为builder 的StringBuilder变量,用于存储文本节点中的字符数据。
I chose to go with the older alternative because of some follow-up work I'm going to do with this code next column, but it's worth keeping StringBuilder in mind for your own J2SE 5.0-specific code.
我之所以选择使用以前的方案,是因为下一篇文章中我将使用该代码进行一些后续工作,但是您应该记住StringBuilder以便用于您自己的特定于J2SE 5.0的代码。
I chose to go with the older alternative because of some follow-up work I'm going to do with this code next column, but it's worth keeping StringBuilder in mind for your own J2SE 5.0-specific code.
我之所以选择使用以前的方案,是因为下一篇文章中我将使用该代码进行一些后续工作,但是您应该记住StringBuilder以便用于您自己的特定于J2SE 5.0的代码。
应用推荐