h2/src/main/org/h2/mvstore/db/TransactionStore.java
/**
         * Iterate over keys.
         *
         * @param iterator the iterator to wrap
         * @param includeUncommitted whether uncommitted entries should be included
         * @return the iterator
         */
Iterate over keys.
@param iterator the iterator to wrap
@param includeUncommitted whether uncommitted entries should be included
@return the iterator
Iterate over keys . @param iterator the iterator to wrap @param includeUncommitted whether uncommitted entries should be included @return the iterator
public Iterator<K> wrapIterator(final Iterator<K> iterator, final boolean includeUncommitted) {
            return new Iterator<K>() {
                private K current;
                {
                    fetchNext();
                }
                private void fetchNext() {
                    while (iterator.hasNext()) {
                        current = iterator.next();
                        if (includeUncommitted) {
                            return;
                        }
                        if (containsKey(current)) {
                            return;
                        }
                    }
                    current = null;
                }
                @Override
                public boolean hasNext() {
                    return current != null;
                }
                @Override
                public K next() {
                    K result = current;
                    fetchNext();
                    return result;
                }
                @Override
                public void remove() {
                    throw DataUtils.newUnsupportedOperationException(
                            "Removing is not supported");
                }
            };
        }
public Iterator < K > wrapIterator ( final Iterator < K > iterator , final boolean includeUncommitted ) { return new Iterator < K > ( ) { private K current ; { fetchNext ( ) ; } private void fetchNext ( ) { while ( iterator . hasNext ( ) ) { current = iterator . next ( ) ; if ( includeUncommitted ) { return ; } if ( containsKey ( current ) ) { return ; } } current = null ; } @ Override public boolean hasNext ( ) { return current != null ; } @ Override public K next ( ) { K result = current ; fetchNext ( ) ; return result ; } @ Override public void remove ( ) { throw DataUtils . newUnsupportedOperationException ( "Removing is not supported" ) ; } } ; }
Iterate over keys.
Iterate over keys .
// TODO duplicate code for wrapIterator and entryIterator