Libraryless. Click here for Pure Java version (2530L/16K).
1 | static <A> Map<A, L<A>> listToMapOfListsWithKeyDetector(IPred<A> keyDetector, L<A> l, A preludeKey) { |
2 | new LinkedHashMap<A, L<A>> map; |
3 | L<A> currentList = null; |
4 | fOr (A a : l) |
5 | if (keyDetector.get(a)) |
6 | map.put(a, currentList = new L); |
7 | else { |
8 | if (currentList == null) |
9 | map.put(preludeKey, currentList = new L); |
10 | currentList.add(a); |
11 | } |
12 | ret map; |
13 | } |
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
Snippet ID: | #1030043 |
Snippet name: | listToMapOfListsWithKeyDetector |
Eternal ID of this version: | #1030043/4 |
Text MD5: | 0f9170f3f21a07c6d6317d8df4387ad6 |
Transpilation MD5: | 13dcee456a1b45269bca1802b5dcf34e |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-11-02 13:21:36 |
Source code size: | 394 bytes / 13 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 170 / 232 |
Version history: | 3 change(s) |
Referenced in: | [show references] |