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).

1  
sclass ScoredStringSearcher extends ScoredSearcher_stable<S> {
2  
  Set<S> seen;
3  
  
4  
  *() {}
5  
  *(S query, O... _) { super(query); }
6  
  
7  
  // true = duplicate entries are filtered out
8  
  selfType uniquify(bool b) {
9  
    seen = b ? new Set : null;
10  
    this;
11  
  }
12  
  
13  
  void put aka add(S s) {
14  
    if (seen == null || seen.add(s))
15  
      put(s, s);
16  
  }
17  
  
18  
  void addAll(Iterable<S> l) {
19  
    fOr (s : l) add(s);
20  
  }
21  
  
22  
  void addAll(S... l) { addAll(asList(l)); }
23  
}

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: 99 / 182
Version history: 5 change(s)
Referenced in: [show references]