Transpiled version (9228L) is out of date.
persistable sclass NotifyingCollection<E> extends AbstractCollection<E> implements Collection<E> { Collection<E> c; // Backing Collection *() {} // for persistence *(Collection<E> *c) {} public int size() { synchronized (this) {return c.size();} } public boolean isEmpty() { synchronized (this) {return c.isEmpty();} } public boolean contains(Object o) { synchronized (this) {return c.contains(o);} } public Object[] toArray() { synchronized (this) {return c.toArray();} } public <T> T[] toArray(T[] a) { synchronized (this) {return c.toArray(a);} } public Iterator<E> iterator() { return c.iterator(); // caller should not use Iterator.remove() } public boolean add(E e) { synchronized (this) { beforeChange(); if (!c.add(e)) false; } change(); true; } public boolean remove(Object o) { synchronized (this) { beforeChange(); if (!c.remove(o)) false;} change(); true; } public boolean containsAll(Collection<?> coll) { synchronized (this) {return c.containsAll(coll);} } public boolean addAll(Collection<? extends E> coll) { synchronized (this) { beforeChange(); if (!c.addAll(coll)) false;} change(); true; } public boolean removeAll(Collection<?> coll) { synchronized (this) { beforeChange(); if (!c.removeAll(coll)) false;} change(); true; } public boolean retainAll(Collection<?> coll) { synchronized (this) { beforeChange(); if (!c.retainAll(coll)) false;} change(); true; } public void clear() { synchronized (this) { beforeChange(); c.clear();} change(); } public String toString() { synchronized (this) {return c.toString();} } /*public void forEach(Consumer<? super E> consumer) { synchronized (this) {c.forEach(consumer);} }*/ /*public boolean removeIf(Predicate<? super E> filter) { synchronized (this) {return c.removeIf(filter);} }*/ @Override public Spliterator<E> spliterator() { return c.spliterator(); // Must be manually synched by user! } /*public Stream<E> stream() { return c.stream(); // Must be manually synched by user! }*/ /*public Stream<E> parallelStream() { return c.parallelStream(); // Must be manually synched by user! }*/ void beforeChange() {} void change() {} Collection<E> unwrap() { ret c; } }
Began life as a copy of #1009405
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1011343 |
Snippet name: | NotifyingCollection - also synchronizes |
Eternal ID of this version: | #1011343/7 |
Text MD5: | 249cb9bdb7591414caaf150409f86f2c |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-10-07 18:15:41 |
Source code size: | 2432 bytes / 77 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 518 / 2003 |
Version history: | 6 change(s) |
Referenced in: | [show references] |