On Nov 16, 2011, at 9:17 AM, lars hofhansl wrote: > Hi Mark, > good find. I think that works by accident and the book is wrong. > "row" + new byte[] {0} will use byte[].toString() and actually result in > something like: "row[B@152b6651", which (again accidentally) sorts past rowN. > "row" + new byte[] {255} is not better, though. > > You'd have to construct a byte array that is terminated by 255. > An easy way to do that is: byte[] row = new byte[] {'r','o','w',-1} > > We need to fix the book.
Wouldn’t the truly correct stopRow be "rox" (since 'w' + 1 == 'x' in Unicode)? The comment in the example (“note: stop key != start key”) is confusing, too. It would be better to say explicitly that the start key is inclusive and the stop key is exclusive, or use the inequality start <= match < stop. joe