/** * Exposes the size of this collection as a value. */ public synchronized ValueView<Integer> sizeView () { if (_sizeView == null) { _sizeView = Value.create(size()); } return _sizeView; }
@Override protected void notify (Notifier notifier, Object a1, Object a2, Object a3) { try { super.notify(notifier, a1, a2, a3); } finally { updateSize(); } }
/** * Returns a reactive value which is true when this collection is empty, false otherwise. */ public ValueView<Boolean> isEmptyView () { return sizeView().map(Functions.lessThanEqual(0)); }
/** * Returns a reactive value which is false when this collection is empty, true otherwise. */ public ValueView<Boolean> isNonEmptyView () { return sizeView().map(Functions.greaterThan(0)); }
/** * Returns a reactive value which is true when this collection is empty, false otherwise. */ public ValueView<Boolean> isEmptyView () { return sizeView().map(Functions.lessThanEqual(0)); }
/** * Exposes the size of this collection as a value. */ public synchronized ValueView<Integer> sizeView () { if (_sizeView == null) { _sizeView = Value.create(size()); } return _sizeView; }
@Override protected void notify (Notifier notifier, Object a1, Object a2, Object a3) { try { super.notify(notifier, a1, a2, a3); } finally { updateSize(); } }
/** * Returns a reactive value which is false when this collection is empty, true otherwise. */ public ValueView<Boolean> isNonEmptyView () { return sizeView().map(Functions.greaterThan(0)); }
/** * Updates the reactive size value. The underlying collection need only call this method if it * changes the size of its collection <em>without</em> also calling {@link #notify}. */ protected void updateSize () { if (_sizeView != null) _sizeView.update(size()); }
/** * Updates the reactive size value. The underlying collection need only call this method if it * changes the size of its collection <em>without</em> also calling {@link #notify}. */ protected void updateSize () { if (_sizeView != null) _sizeView.update(size()); }