Libraryless. Click here for Pure Java version (3970L/23K).
1 | // Yes the nomenclature is a bit illogical |
2 | |
3 | static <A> Chain<A> chainPlus(Chain<A> chain, A a) { |
4 | ret Chain<A>(a, chain); |
5 | } |
6 | |
7 | static <A> Chain<A> chainPlus(Chain<A> chain, A... l) { |
8 | fOr (A a : l) |
9 | chain = chainPlus(chain, a); |
10 | ret chain; |
11 | } |
12 | |
13 | static <A> ReverseChain<A> chainPlus(ReverseChain<A> chain, A a) { |
14 | ret ReverseChain<A>(chain, a); |
15 | } |
16 | |
17 | static <A> ReverseChain<A> chainPlus(ReverseChain<A> chain, A... l) { |
18 | fOr (A a : l) |
19 | chain = chainPlus(chain, a); |
20 | ret chain; |
21 | } |
22 | |
23 | ifclass AppendableChain |
24 | static <A> AppendableChain<A> chainPlus(AppendableChain<A> chain, A a) { |
25 | if (chain == null) ret new AppendableChain<A>(a); |
26 | chain.add(a); |
27 | ret chain; |
28 | } |
29 | |
30 | static <A> AppendableChain<A> chainPlus(AppendableChain<A> chain, A... l) { |
31 | fOr (A a : l) |
32 | chain = chainPlus(chain, a); |
33 | ret chain; |
34 | } |
35 | endif |
Began life as a copy of #1027932
download show line numbers debug dex old transpilations
Travelled to 5 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
Snippet ID: | #1030670 |
Snippet name: | chainPlus - append to Chain (to beginning) or to AppendableChain/ReverseChain (to the end) |
Eternal ID of this version: | #1030670/13 |
Text MD5: | 0f2985590a31ae80c0e89309793f641c |
Transpilation MD5: | 755d7c71173c64384803ca86a1f1f17b |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-10-07 13:37:18 |
Source code size: | 847 bytes / 35 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 229 / 337 |
Version history: | 12 change(s) |
Referenced in: | [show references] |