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

8
LINES

< > BotCompany Repo | #1023059 // WeightedSet

JavaX fragment (include)

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

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