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

23
LINES

< > BotCompany Repo | #1034155 // ScoredStringSearcher

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

Libraryless. Click here for Pure Java version (6234L/34K).

sclass ScoredStringSearcher extends ScoredSearcher_stable<S> {
  Set<S> seen;
  
  *() {}
  *(S query, O... _) { super(query); }
  
  // true = duplicate entries are filtered out
  selfType uniquify(bool b) {
    seen = b ? new Set : null;
    this;
  }
  
  void put aka add(S s) {
    if (seen == null || seen.add(s))
      put(s, s);
  }
  
  void addAll(Iterable<S> l) {
    fOr (s : l) add(s);
  }
  
  void addAll(S... l) { addAll(asList(l)); }
}

Author comment

Began life as a copy of #1032524

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034155
Snippet name: ScoredStringSearcher
Eternal ID of this version: #1034155/6
Text MD5: 0cf97b2da8e54db88db3f5ece2e7504f
Transpilation MD5: 5985a7e790ea02908feb24c828fc96bd
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-08 06:54:31
Source code size: 474 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 156 / 269
Version history: 5 change(s)
Referenced in: #1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674)