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

8
LINES

< > BotCompany Repo | #1023059 // WeightedSet

JavaX fragment (include)

1  
sclass WeightedSet<A> extends WrappedMap<A, Double> {
2  
  *() { super(new HashMap); }
3  
  
4  
  bool contains(A a) { ret containsKey(a); }
5  
  public Double get(O a) { ret or0(super.get(a)); }
6  
  double getWeight(A a) { ret get(a); }
7  
  void add(A a) { put(a, 1.0); }
8  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1023059
Snippet name: WeightedSet
Eternal ID of this version: #1023059/6
Text MD5: 86e92090a7d44acc958963500f270bb9
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-04-30 17:05:50
Source code size: 265 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 298 / 701
Version history: 5 change(s)
Referenced in: [show references]