Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

7
LINES

< > BotCompany Repo | #1024228 // shrinkStringBufferIf50PercentSlack

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (32L/1K).

svoid shrinkStringBufferIf50PercentSlack(StringBuffer buf) {
  if (buf == null) ret;
  synchronized(buf) {
    if (buf.capacity() >= buf.length()*2)
      buf.trimToSize();
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1024228
Snippet name: shrinkStringBufferIf50PercentSlack
Eternal ID of this version: #1024228/1
Text MD5: 7673852655bb58d6bd8ea3cc3d97d1f0
Transpilation MD5: 1781337a397eb0f18ce220dc915a5540
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-07-28 13:40:14
Source code size: 184 bytes / 7 lines
Pitched / IR pitched: No / No
Views / Downloads: 196 / 286
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)