Libraryless. Click here for Pure Java version (7901L/45K).
1 | static <A> AutoCloseable tempAdd(Cl<A> l, A a) { |
2 | if (l == null || l.contains(a)) null; |
3 | l.add(a); |
4 | ret new tempAdd_undo(l, a); |
5 | } |
6 | |
7 | srecord noeq tempAdd_undo<A>(Cl<A> l, A a) is AutoCloseable { |
8 | close { l.remove(a); } |
9 | } |
10 | |
11 | static AutoCloseable tempAdd(Container a, Component b) { |
12 | if (a == null || b == null) null; |
13 | swing { |
14 | if (b.getParent() == a) null; |
15 | a.add(b); |
16 | ret -> swing { |
17 | if (b.getParent() == a) |
18 | removeFromParent(b); |
19 | }; |
20 | } |
21 | } |
Began life as a copy of #1016563
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1017722 |
Snippet name: | tempAdd - temporarily add to collection or container |
Eternal ID of this version: | #1017722/7 |
Text MD5: | 09b1292b6db7e9d7d58f4fc28a76f803 |
Transpilation MD5: | 5c673b82210a3d6c70ca5ebdd02a3fd2 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-05-06 01:22:35 |
Source code size: | 485 bytes / 21 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 452 / 575 |
Version history: | 6 change(s) |
Referenced in: | [show references] |