Libraryless. Click here for Pure Java version (3839L/22K).
static <A> A listGetOrCreate(L<A> l, int i, Class<? extends A> c) { ret listGetOrCreate(l, i, -> nuInstance(c)); } static <A> A listGetOrCreate(L<A> l, int i, IF0<A> f) { if (l == null) null; A a = get(l, i); if (a == null) listSet(l, i, a = f!); ret a; } static <A> A nuLike listGetOrCreate(Class<? extends A> c, L<A> l, int i) { ret listGetOrCreate(l, i, c); }
Began life as a copy of #1021808
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: | #1022705 |
| Snippet name: | listGetOrCreate |
| Eternal ID of this version: | #1022705/5 |
| Text MD5: | f78abdbcae61ace9a416d2a92d717ac6 |
| Transpilation MD5: | c9003c886d121c1b5f06c6b5e1983577 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2021-10-15 20:54:46 |
| Source code size: | 394 bytes / 15 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 568 / 718 |
| Version history: | 4 change(s) |
| Referenced in: | [show references] |