`
leonzhx
  • 浏览: 796827 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

Item 51: Beware the performance of string concatenation

阅读更多

1.  Using the string concatenation operator repeatedly to concatenate n strings requires time quadratic in n. It is an unfortunate consequence of the fact that strings are immutable.

 

2.  To achieve acceptable performance, use a StringBuilder in place of a String to store the string under construction. The StringBuilder class, added in release 1.5, is an unsynchronized replacement for StringBuffer, which is less efficient in single thread environment.

 

分享到:
评论

相关推荐

    Effective Java 3rd edition(Effective Java第三版英文原版)附第二版

    Item 63: Beware the performance of string concatenation Item 64: Refer to objects by their interfaces Item 65: Prefer interfaces to reflection Item 66: Use native methods judiciously Item 67: Optimize...

    Hackers Beware The Ultimate Guide to Network Security

    Hackers Beware The Ultimate Guide to Network Security.pdf

    一本android的好书beginning android 2 和 源码

    Beware of the BLOB! ■Chapter 27: Building a Content Provider First, Some Dissection Next, Some Typing Creating Your Content Provider Step 1: Create a Provider Class Step 2: Supply a Uri Step 3: ...

    Object-Oriented Software Construction 2nd

    17.7 BEWARE OF POLYMORPHIC CATCALLS! 636 17.8 AN ASSESSMENT 639 17.9 THE PERFECT FIT 640 17.10 KEY CONCEPTS STUDIED IN THIS CHAPTER 641 17.11 BIBLIOGRAPHICAL NOTES 641 Chapter 18: Global objects and ...

    beware ircd 源码

    【标题】:“beware ircd 源码”是指一种基于IRC(Internet Relay Chat)协议的服务器源代码,用于构建自定义的IRC网络服务。IRC是一种实时通讯协议,主要用于在线聊天和协作,允许用户创建频道并与其他用户进行交互...

    Google C++ Style Guide(Google C++编程规范)高清PDF

    Correct use of header files can make a huge difference to the readability, size and performance of your code. The following rules will guide you through the various pitfalls of using header files. ...

    Django 1.1 Testing and Debugging.pdf

    The TEMPLATE_STRING_IF_INVALID setting 171 Debug error pages 172 Database query history 176 Debug support in the development server 179 Handling problems in production 182 Creating general error ...

    Beware

    标题"Beware"通常暗示可能存在某种警告或需要注意的情况。在IT领域,这可能指的是与软件、安全或技术问题相关的警示。在这种情况下,标签“字体”为我们提供了更具体的线索,表明我们可能正在讨论一种特定的字体或者...

    c++ Effective STL(中文+英文)

    Beware the illusion of container-independent code................................4 Item 3. Make copying cheap and correct for objects in containers.....................9 Item 4. Call empty instead of...

    1984 George Orwell (英文版).mobi

    It's like a warning label that never fades, and it is a wake-up call for the world to beware of this expected darkness. This work is known as one of the most profound literary classics of the 20th ...

    后跟介词的动词和形容词中考必背.doc

    - `beware of`:当心 - `boast of/about`:自夸 - `complain of/about`:抱怨 - `consist of`:由...组成 - `convince of/about`:使某人相信 - `cure of`:治愈 - `despair of`:对...失去希望 - `dream of...

    Beyond Software Architecture: Creating and Sustaining Winning Solutions

    Portability The Perceived Advantages of Portability The Business Case for Portability Creating Portable Applications The Matrix of Pain Beware the Promises You Make ...

    Mac OS X Lion The Missing Manual

    and customers complained of the “spaghetti code” the Mac OS had become. On the other hand, underneath Mac OS X’s classy translucent desktop is Unix, the industrial-strength, rock-solid OS that ...

    Beware-of-the-ninja-bear:食客冲生存游戏的原型

    小心忍者熊 这是一款玩家使用 xbox 或 ps4 控制器的游戏。 每个玩家都被安排在游戏的一个角落。 玩家很饿,所以他们的健康栏总是在减少。 为了度过高峰期,他们必须吃东西。 游戏中有两种食物:快餐和健康食品。...

    tl866cs转tl866a V2.5

    This is important if you leave the copy protect bit unchecked then the new firmware will disable the bootmode, so beware! 5.Serial number and device code section. Just click the write button in the ...

    serilum-mc-mods:一个在CurseForge上发布Serilum Minecraft mod的问题和内容建议的中心

    一个针对CurseForge上Serilum的mod的问题和内容建议的中心。 您可以创建一个,如果你发现了一个bug,有一个功能的想法,想要说些什么,或者只是想请教一个问题。 请指定正确的标签,谢谢! :) 从2021年2月开始,我的...

    播放mp3的控件.rar_Elsounds_Slider.p_Windows Audio_audio_mmsystem

    It seems to work correctly, but beware of BETA! Please, notify me, when Microsoft releases the final version of the SDK. Redistribution terms for this module consist of two parts. 1) wmamp.esp ...

Global site tag (gtag.js) - Google Analytics