private List<OIdentifiable> cursorToList(OIndexCursor cursor) {
   final List<OIdentifiable> currentResult = new ArrayList<OIdentifiable>();
   Map.Entry<Object, OIdentifiable> entry = cursor.nextEntry();
   while (entry != null) {
     currentResult.add(entry.getValue());
     entry = cursor.nextEntry();
   }
   return currentResult;
 }
    @Override
    public Map.Entry<Object, OIdentifiable> nextEntry() {
      if (currentIterator == null) return null;

      while (!currentIterator.hasNext()) {
        final Map.Entry<Object, OIdentifiable> entry = internalCursor.nextEntry();

        if (entry == null) {
          currentIterator = null;
          return null;
        }

        queryResult.clear();
        queryResult.addAll(applyTailIndexes(entry.getValue()));

        currentIterator = queryResult.iterator();
      }

      if (!currentIterator.hasNext()) {
        currentIterator = null;
        return null;
      }

      final OIdentifiable result = currentIterator.next();

      return new Map.Entry<Object, OIdentifiable>() {
        @Override
        public Object getKey() {
          throw new UnsupportedOperationException("getKey");
        }

        @Override
        public OIdentifiable getValue() {
          return result;
        }

        @Override
        public OIdentifiable setValue(OIdentifiable value) {
          throw new UnsupportedOperationException("setValue");
        }
      };
    }