static AutoCloseable tempAdd(Cl l, A a) {
if (l == null || l.contains(a)) null;
l.add(a);
ret new tempAdd_undo(l, a);
}
srecord noeq tempAdd_undo(Cl l, A a) is AutoCloseable {
close { l.remove(a); }
}
static AutoCloseable tempAdd(Container a, Component b) {
if (a == null || b == null) null;
swing {
if (b.getParent() == a) null;
a.add(b);
ret -> swing {
if (b.getParent() == a)
removeFromParent(b);
};
}
}