Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

98
LINES

< > BotCompany Repo | #1031163 // SynchronizedNavigableMap

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (5670L/31K).

1  
persistable sclass SynchronizedNavigableMap<K,V> extends SynchronizedSortedMap<K,V> is NavigableMap<K,V>
2  
{
3  
    NavigableMap<K, V> innerMap() { ret (NavigableMap) m; }
4  
5  
    SynchronizedNavigableMap(NavigableMap<K,V> m) {
6  
        super(m);
7  
    }
8  
    SynchronizedNavigableMap(NavigableMap<K,V> m, Object mutex) {
9  
        super(m, mutex);
10  
    }
11  
12  
    public Entry<K, V> lowerEntry(K key)
13  
                    { synchronized (mutex) { return innerMap().lowerEntry(key); } }
14  
    public K lowerKey(K key)
15  
                      { synchronized (mutex) { return innerMap().lowerKey(key); } }
16  
    public Entry<K, V> floorEntry(K key)
17  
                    { synchronized (mutex) { return innerMap().floorEntry(key); } }
18  
    public K floorKey(K key)
19  
                      { synchronized (mutex) { return innerMap().floorKey(key); } }
20  
    public Entry<K, V> ceilingEntry(K key)
21  
                  { synchronized (mutex) { return innerMap().ceilingEntry(key); } }
22  
    public K ceilingKey(K key)
23  
                    { synchronized (mutex) { return innerMap().ceilingKey(key); } }
24  
    public Entry<K, V> higherEntry(K key)
25  
                   { synchronized (mutex) { return innerMap().higherEntry(key); } }
26  
    public K higherKey(K key)
27  
                     { synchronized (mutex) { return innerMap().higherKey(key); } }
28  
    public Entry<K, V> firstEntry()
29  
                       { synchronized (mutex) { return innerMap().firstEntry(); } }
30  
    public Entry<K, V> lastEntry()
31  
                        { synchronized (mutex) { return innerMap().lastEntry(); } }
32  
    public Entry<K, V> pollFirstEntry()
33  
                   { synchronized (mutex) { return innerMap().pollFirstEntry(); } }
34  
    public Entry<K, V> pollLastEntry()
35  
                    { synchronized (mutex) { return innerMap().pollLastEntry(); } }
36  
37  
    public NavigableMap<K, V> descendingMap() {
38  
        synchronized (mutex) {
39  
            return
40  
                new SynchronizedNavigableMap<>(innerMap().descendingMap(), mutex);
41  
        }
42  
    }
43  
44  
    public NavigableSet<K> keySet() {
45  
        return navigableKeySet();
46  
    }
47  
48  
    public NavigableSet<K> navigableKeySet() {
49  
        synchronized (mutex) {
50  
            return new SynchronizedNavigableSet<>(innerMap().navigableKeySet(), mutex);
51  
        }
52  
    }
53  
54  
    public NavigableSet<K> descendingKeySet() {
55  
        synchronized (mutex) {
56  
            return new SynchronizedNavigableSet<>(innerMap().descendingKeySet(), mutex);
57  
        }
58  
    }
59  
60  
61  
    public SortedMap<K,V> subMap(K fromKey, K toKey) {
62  
        synchronized (mutex) {
63  
            return new SynchronizedNavigableMap<>(
64  
                innerMap().subMap(fromKey, true, toKey, false), mutex);
65  
        }
66  
    }
67  
    public SortedMap<K,V> headMap(K toKey) {
68  
        synchronized (mutex) {
69  
            return new SynchronizedNavigableMap<>(innerMap().headMap(toKey, false), mutex);
70  
        }
71  
    }
72  
    public SortedMap<K,V> tailMap(K fromKey) {
73  
        synchronized (mutex) {
74  
    return new SynchronizedNavigableMap<>(innerMap().tailMap(fromKey, true),mutex);
75  
        }
76  
    }
77  
78  
    public NavigableMap<K, V> subMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive) {
79  
        synchronized (mutex) {
80  
            return new SynchronizedNavigableMap<>(
81  
                innerMap().subMap(fromKey, fromInclusive, toKey, toInclusive), mutex);
82  
        }
83  
    }
84  
85  
    public NavigableMap<K, V> headMap(K toKey, boolean inclusive) {
86  
        synchronized (mutex) {
87  
            return new SynchronizedNavigableMap<>(
88  
                    innerMap().headMap(toKey, inclusive), mutex);
89  
        }
90  
    }
91  
92  
    public NavigableMap<K, V> tailMap(K fromKey, boolean inclusive) {
93  
        synchronized (mutex) {
94  
            return new SynchronizedNavigableMap<>(
95  
                innerMap().tailMap(fromKey, inclusive), mutex);
96  
        }
97  
    }
98  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1031163
Snippet name: SynchronizedNavigableMap
Eternal ID of this version: #1031163/4
Text MD5: 4343ea7d77f878feb3d9b61f473fbb78
Transpilation MD5: dba6c74403f46d29eebd267621c7d071
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:22:33
Source code size: 3875 bytes / 98 lines
Pitched / IR pitched: No / No
Views / Downloads: 202 / 412
Version history: 3 change(s)
Referenced in: [show references]