@Override
 public Cursor findFirstOrLast(Session session, boolean first) {
   TransactionMap<Value, Value> map = getMap(session);
   Value v = first ? map.firstKey() : map.lastKey();
   if (v == null) {
     return new MVStoreCursor(session, Collections.<Value>emptyList().iterator(), 0);
   }
   long key = v.getLong();
   MVStoreCursor cursor =
       new MVStoreCursor(session, Arrays.asList((Value) ValueLong.get(key)).iterator(), key);
   cursor.next();
   return cursor;
 }
 @Override
 public Cursor findFirstOrLast(Session session, boolean first) {
   TransactionMap<Value, Value> map = getMap(session);
   ValueLong v = (ValueLong) (first ? map.firstKey() : map.lastKey());
   if (v == null) {
     return new MVStoreCursor(
         session, Collections.<Entry<Value, Value>>emptyList().iterator(), null);
   }
   Value value = map.get(v);
   Entry<Value, Value> e = new DataUtils.MapEntry<Value, Value>(v, value);
   @SuppressWarnings("unchecked")
   List<Entry<Value, Value>> list = Arrays.asList(e);
   MVStoreCursor c = new MVStoreCursor(session, list.iterator(), v);
   c.next();
   return c;
 }