Libraryless. Click here for Pure Java version (2039L/13K).
1 | svoid mapMethodLike internByteArrayField(S field, Cl l) { |
2 | HashMap<HashedByteArray, byte[]> map = new HashMap; |
3 | fOr (O o : l) { |
4 | byte[] value = cast getOpt(o, field); |
5 | if (value == null) continue; |
6 | HashedByteArray hashed = new(value); |
7 | byte[] existing = map.get(hashed); |
8 | if (existing != null) |
9 | setOpt(o, field, existing); |
10 | else |
11 | map.put(hashed, value); |
12 | } |
13 | } |
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1024843 |
Snippet name: | internByteArrayField - share equal byte arrays between objects |
Eternal ID of this version: | #1024843/6 |
Text MD5: | d6ed2d38dd5123debb04b4ea81153555 |
Transpilation MD5: | 8101860b50d4b9cd40358edc8662944b |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-08-26 21:58:04 |
Source code size: | 401 bytes / 13 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 213 / 335 |
Version history: | 5 change(s) |
Referenced in: | [show references] |