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

41
LINES

< > BotCompany Repo | #1031164 // SynchronizedSortedMap

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

Libraryless. Click here for Pure Java version (5358L/29K).

persistable sclass SynchronizedSortedMap<K,V>
    extends SynchronizedMap<K,V>
    is SortedMap<K,V>
{
    SortedMap<K, V> innerMap() { ret (SortedMap) m; }

    SynchronizedSortedMap(SortedMap<K,V> m) {
        super(m);
    }
    SynchronizedSortedMap(SortedMap<K,V> m, Object mutex) {
        super(m, mutex);
    }

    public Comparator<? super K> comparator() {
        synchronized (mutex) {return innerMap().comparator();}
    }

    public SortedMap<K,V> subMap(K fromKey, K toKey) {
        synchronized (mutex) {
            return new SynchronizedSortedMap<>(
                innerMap().subMap(fromKey, toKey), mutex);
        }
    }
    public SortedMap<K,V> headMap(K toKey) {
        synchronized (mutex) {
            return new SynchronizedSortedMap<>(innerMap().headMap(toKey), mutex);
        }
    }
    public SortedMap<K,V> tailMap(K fromKey) {
        synchronized (mutex) {
           return new SynchronizedSortedMap<>(innerMap().tailMap(fromKey),mutex);
        }
    }

    public K firstKey() {
        synchronized (mutex) {return innerMap().firstKey();}
    }
    public K lastKey() {
        synchronized (mutex) {return innerMap().lastKey();}
    }
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1031164
Snippet name: SynchronizedSortedMap
Eternal ID of this version: #1031164/4
Text MD5: b4dae3003072d12551fea37598005459
Transpilation MD5: f610d52c1e9d6afe27871c125111ec64
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:21:28
Source code size: 1225 bytes / 41 lines
Pitched / IR pitched: No / No
Views / Downloads: 177 / 386
Version history: 3 change(s)
Referenced in: [show references]