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

19
LINES

< > BotCompany Repo | #1028864 // CountingVarMaker

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

Libraryless. Click here for Pure Java version (2563L/16K).

sclass CountingVarMaker implements VarMaker {
  S prefix = "";
  Set<S> taken = ciSet();
  int i;
  
  *() {}
  *(S *prefix) {}
  *(S *prefix, Cl<S> taken) { addAll(this.taken, taken); }
  
  public void addTaken(S s) { taken.add(s); }
  
  public S get() {
    S s;
    do ping {
      s = prefix + ++i;
    } while (taken.contains(s));
    ret s;
  }
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1028864
Snippet name: CountingVarMaker
Eternal ID of this version: #1028864/5
Text MD5: c8b50cefc5bd2f03a4984feff4810fb0
Transpilation MD5: 02de23f9f6a0dc05f6ea5e69409e898c
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-07-10 19:36:26
Source code size: 372 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 239 / 525
Version history: 4 change(s)
Referenced in: #1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674)