@Override protected Vital doRemove(int index) { Vital v = vitals.remove(index); elementObserver.detachListener(v); v.removeListener(this); if (null != v) { v.destroy(); } return v; }
@Override protected Vital doSet(int index, Vital element) { Vital removed = vitals.set(index, element); removed.removeListener(this); elementObserver.detachListener(removed); elementObserver.attachListener(element); removed.addListener(this); numericList.forEach((fx) -> addNumeric(fx)); return removed; }
@Override public void clear() { if (elementObserver != null) { final int sz = size(); for (int i = 0; i < sz; ++i) { get(i).removeListener(this); elementObserver.detachListener(get(i)); } } if (hasListeners()) { beginChange(); nextRemove(0, this); } vitals.clear(); ++modCount; if (hasListeners()) { endChange(); } }