1 | persistable sclass SynchronizedSortedMap<K,V> |
2 | extends SynchronizedMap<K,V> |
3 | implements SortedMap<K,V> |
4 | { |
5 | // not final because persistence |
6 | private /*final*/ SortedMap<K,V> sm; |
7 | |
8 | SynchronizedSortedMap(SortedMap<K,V> m) { |
9 | super(m); |
10 | sm = m; |
11 | } |
12 | SynchronizedSortedMap(SortedMap<K,V> m, Object mutex) { |
13 | super(m, mutex); |
14 | sm = m; |
15 | } |
16 | |
17 | public Comparator<? super K> comparator() { |
18 | synchronized (mutex) {return sm.comparator();} |
19 | } |
20 | |
21 | public SortedMap<K,V> subMap(K fromKey, K toKey) { |
22 | synchronized (mutex) { |
23 | return new SynchronizedSortedMap<>( |
24 | sm.subMap(fromKey, toKey), mutex); |
25 | } |
26 | } |
27 | public SortedMap<K,V> headMap(K toKey) { |
28 | synchronized (mutex) { |
29 | return new SynchronizedSortedMap<>(sm.headMap(toKey), mutex); |
30 | } |
31 | } |
32 | public SortedMap<K,V> tailMap(K fromKey) { |
33 | synchronized (mutex) { |
34 | return new SynchronizedSortedMap<>(sm.tailMap(fromKey),mutex); |
35 | } |
36 | } |
37 | |
38 | public K firstKey() { |
39 | synchronized (mutex) {return sm.firstKey();} |
40 | } |
41 | public K lastKey() { |
42 | synchronized (mutex) {return sm.lastKey();} |
43 | } |
44 | } |
Began life as a copy of #1031164
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1034595 |
Snippet name: | SynchronizedSortedMap (backup with extra field) |
Eternal ID of this version: | #1034595/1 |
Text MD5: | 01cf7a47b7af5570f8e1d52c6e306046 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-02-19 08:19:59 |
Source code size: | 1244 bytes / 44 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 146 / 146 |
Referenced in: | [show references] |