persistable sclass SynchronizedSortedMap extends SynchronizedMap is SortedMap { SortedMap innerMap() { ret (SortedMap) m; } SynchronizedSortedMap(SortedMap m) { super(m); } SynchronizedSortedMap(SortedMap m, Object mutex) { super(m, mutex); } public Comparator comparator() { synchronized (mutex) {return innerMap().comparator();} } public SortedMap subMap(K fromKey, K toKey) { synchronized (mutex) { return new SynchronizedSortedMap<>( innerMap().subMap(fromKey, toKey), mutex); } } public SortedMap headMap(K toKey) { synchronized (mutex) { return new SynchronizedSortedMap<>(innerMap().headMap(toKey), mutex); } } public SortedMap 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();} } }