When running retrieve multiple items from an index with the nextunique or prevunique direction, we iterate over items in a while loop.
- Let i be 0.
- While i is less than rangeRecordsLength, then:
- Increase i by 1.
- if record’s size is equal to count, then break.
- If the result of comparing two keys using the keys from |rangeRecords[i]| and |rangeRecords[i-1]| is equal, then continue.
- Else append |rangeRecords[i]| to records.
This means
range_records[0] will never be added to records.
- We always start with
i = 1
- In the last iteration, we will try to access
range_records[length], and that is out of bounds.
- We check for
less than, then increment it to be equal
Suggested solution:
- Change
While i is less than range records length to While i is less than range records length - 1
- Add new step between current 3 and 4:
Append |range records[0]| to records.
When running retrieve multiple items from an index with the
nextuniqueorprevuniquedirection, we iterate over items in a while loop.This means
range_records[0]will never be added torecords.i = 1range_records[length], and that is out of bounds.less than, then increment it to be equalSuggested solution:
While i is less than range records lengthtoWhile i is less than range records length - 1Append |range records[0]| to records.