Libraryless. Click here for Pure Java version (2933L/17K).
persistable static class SynchronizedSortedSet<E> extends SynchronizedSet<E> implements SortedSet<E> { @java.io.Serial private static final long serialVersionUID = 8695801310862127406L; @SuppressWarnings("serial") // Conditionally serializable /*private final*/ SortedSet<E> ss; SynchronizedSortedSet(SortedSet<E> s) { super(s); ss = s; } SynchronizedSortedSet(SortedSet<E> s, Object mutex) { super(s, mutex); ss = s; } public Comparator<? super E> comparator() { synchronized (mutex) {return ss.comparator();} } public SortedSet<E> subSet(E fromElement, E toElement) { synchronized (mutex) { return new SynchronizedSortedSet<>( ss.subSet(fromElement, toElement), mutex); } } public SortedSet<E> headSet(E toElement) { synchronized (mutex) { return new SynchronizedSortedSet<>(ss.headSet(toElement), mutex); } } public SortedSet<E> tailSet(E fromElement) { synchronized (mutex) { return new SynchronizedSortedSet<>(ss.tailSet(fromElement),mutex); } } public E first() { synchronized (mutex) {return ss.first();} } public E last() { synchronized (mutex) {return ss.last();} } }
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt, wnsclhtenguj
No comments. add comment
Snippet ID: | #1031166 |
Snippet name: | SynchronizedSortedSet |
Eternal ID of this version: | #1031166/3 |
Text MD5: | 76c5608efd112509fbc8ff9c99edef74 |
Transpilation MD5: | 797ca6ad301c72740324bb1d168a6569 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-05-16 17:48:16 |
Source code size: | 1372 bytes / 47 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 151 / 570 |
Version history: | 2 change(s) |
Referenced in: | [show references] |