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

6
LINES

< > BotCompany Repo | #1032060 // truncateTreeSetWithDuplicates

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

Libraryless. Click here for Pure Java version (3831L/22K).

svoid <A> truncateTreeSetWithDuplicates(TreeSetWithDuplicates<A> set, int maxLength) {
  if (set == null) ret;
  if (maxLength < 0) fail();
  while ping (l(set) > maxLength)
    set.remove(set.last());
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx

No comments. add comment

Snippet ID: #1032060
Snippet name: truncateTreeSetWithDuplicates
Eternal ID of this version: #1032060/2
Text MD5: 69327c3a77df9c0c48077bcab3d2b316
Transpilation MD5: 9276948b9ff35d773553867f273bb45d
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-08-11 08:49:13
Source code size: 208 bytes / 6 lines
Pitched / IR pitched: No / No
Views / Downloads: 151 / 222
Version history: 1 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)