Libraryless. Click here for Pure Java version (2767L/17K).
1 | sclass ObjectIndexByClass { |
2 | // preserving addition order is nice |
3 | MultiSetMap<Class, O> index = multiSetMap_innerLinkedHashSet(); |
4 | |
5 | void add(O o) { |
6 | if (o != null) |
7 | index.put(o.getClass(), o); |
8 | } |
9 | |
10 | void remove(O o) { |
11 | if (o != null) |
12 | index.remove(o.getClass(), o); |
13 | } |
14 | |
15 | // never returns null |
16 | <A> Set<A> get(Class<A> c) { |
17 | ret (Set) index.get(c); |
18 | } |
19 | } |
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: | #1028372 |
Snippet name: | ObjectIndexByClass |
Eternal ID of this version: | #1028372/4 |
Text MD5: | 746488b3a3797a9dd1202a2c74c59eb8 |
Transpilation MD5: | 7b274b753a29ea290506a8e659621cf6 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-06-14 16:57:32 |
Source code size: | 404 bytes / 19 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 251 / 555 |
Version history: | 3 change(s) |
Referenced in: | [show references] |