src/main/java/com/workplacesystems/utilsj/collections/TransactionalBidiTreeMap.java
@Override
    public Set<K> keySet() {

        if (setOfKeysByKey == null) {
            setOfKeysByKey = new AbstractFilterableSet<K>() {

                @Override
                public Iterator<K> iterator() {

                    return new TransactionalBidiTreeMapIterator<K>(KEY) {

                        @Override
                        protected K doGetNext() {
                            return (K)lastReturnedNode.getData(KEY);
                        }
                    };
                }

                @Override
                public int size() {
                    return TransactionalBidiTreeMap.this.size();
                }

                @Override
                public boolean contains(Object o) {
                    return containsKey(o);
                }

                @Override
                public boolean remove(Object o) {

                    int oldNodeCount = nodeCount;

                    TransactionalBidiTreeMap.this.remove(o);

                    return nodeCount != oldNodeCount;
                }

                @Override
                public void clear() {
                    TransactionalBidiTreeMap.this.clear();
                }
            };
        }

        return setOfKeysByKey;
    }
@Override
    public Set<K> keySet() {

        if (setOfKeysByKey == null) {
            setOfKeysByKey = new AbstractFilterableSet<K>() {

                @Override
                public Iterator<K> iterator() {

                    return new TransactionalBidiTreeMapIterator<K>(KEY) {

                        @Override
                        protected K doGetNext() {
                            return (K)lastReturnedNode.getData(KEY);
                        }
                    };
                }

                @Override
                public int size() {
                    return TransactionalBidiTreeMap.this.size();
                }

                @Override
                public boolean contains(Object o) {
                    return containsKey(o);
                }

                @Override
                public boolean remove(Object o) {

                    int oldNodeCount = nodeCount;

                    TransactionalBidiTreeMap.this.remove(o);

                    return nodeCount != oldNodeCount;
                }

                @Override
                public void clear() {
                    TransactionalBidiTreeMap.this.clear();
                }
            };
        }

        return setOfKeysByKey;
    }
Returns a set view of the keys contained in this map.  The set
is backed by the map, so changes to the map are reflected in
the set, and vice-versa. If the map is modified while an
iteration over the set is in progress, the results of the
iteration are undefined. The set supports element removal,
which removes the corresponding mapping from the map, via the
Iterator.remove, Set.remove, removeAll, retainAll, and clear
operations.  It does not support the add or addAll operations.

@return a set view of the keys contained in this map.